2017-04-12 52 views
0

我創建一個自定義驗證一個簡單的WCF項目,你可以看到我的配置文件:wcf無法爲具有綁定BasicHttpsBinding的端點找到匹配scheme https的基地址。

<system.serviceModel> 

    <services> 
     <service name="WcfService1.Service1" behaviorConfiguration="authBehavior"> 

     <!-- Service Endpoints. A Service may provide multiple endpoints --> 
     <!-- Not need to define host. Relative --> 
     <endpoint address="" binding="basicHttpsBinding" contract="WcfService1.IService1" bindingConfiguration="httpsBindingConfig"> 
      <!-- 
       Upon deployment, the following identity element should be removed or replaced to reflect the 
       identity under which the deployed service runs. If removed, WCF will infer an appropriate identity 
       automatically. 
      --> 
      <identity> 
      <dns value="localhost" /> 
      </identity> 
     </endpoint> 


     <!-- Metadata Endpoints --> 
     <!-- The Metadata Exchange endpoint is used by the service to describe itself to clients. --> 
     <!-- This endpoint does not use a secure binding and should be secured or removed before deployment --> 
     <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> 
     </service> 
    </services> 
    <bindings> 
     <basicHttpsBinding> 
     <binding name="httpsBindingConfig"> 
      <security mode="TransportWithMessageCredential"> 
      <message clientCredentialType="UserName" /> 
      <transport clientCredentialType="None" /> 
      </security> 
     </binding> 
     </basicHttpsBinding> 
     <basicHttpBinding> 
     <binding name="basicHttpBindingConfig"> 
      <security mode="TransportWithMessageCredential"> 
      <message clientCredentialType="UserName" /> 
      </security> 
     </binding> 
     </basicHttpBinding> 
    </bindings> 
    <behaviors> 
     <serviceBehaviors> 

      <behavior name="authBehavior"> 
     <serviceCredentials> 
     <userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="WcfService1.IdentityValidator,WcfService1" /> 
     </serviceCredentials> 
     <serviceAuthorization principalPermissionMode="Custom" serviceAuthorizationManagerType="WcfService1.RoleAuthorizationManager,WcfService1"> 

     </serviceAuthorization> 

    </behavior> 
     </serviceBehaviors> 
    </behaviors> 

    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/> 
    </system.serviceModel> 

當我跑我的服務,我得到了自己的錯誤:

Could not find a base address that matches scheme https for the endpoint with binding BasicHttpsBinding. Registered base address schemes are [http]. 

我很新的WCF對不起爲我簡單的問題。

回答

0

解決方案是啓用wcf項目的SSL。

0

你缺少的基地址服務配置:

<service name="WcfService1.Service1" behaviorConfiguration="authBehavior"> 

    ... 

    <host> 
    <baseAddresses> 
     <add baseAddress="https://localhost/myserviceaddress/" /> 
    </baseAddresses> 
    </host> 
</service> 
相關問題