2016-09-16 62 views
0

我有一个将通过IIS部署的WCF服务应用程序。C#WCF服务应用程序基地址问题

服务的开发URL是http://localhost:42543/Loyalty.svc,但是当它发布到Web服务器时,URL将是http://ServerName:1066/Loyalty.svc

然而,当我浏览到的URL我得到以下错误:

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

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: Could not find a base address that matches scheme https for the endpoint with binding WSHttpBinding. Registered base address schemes are [http].

该网站的Web.config是在这里:

<system.serviceModel> 
    <bindings> 
     <wsHttpBinding> 
     <binding name="wsSecureBinding"> 
      <security mode="TransportWithMessageCredential"> 
      <message clientCredentialType="UserName"/> 
      <transport clientCredentialType="None" proxyCredentialType="None" /> 
      </security> 
     </binding> 
     </wsHttpBinding> 
    </bindings> 
    <services> 
     <service behaviorConfiguration="default" name="IISService.Loyalty"> 
     <endpoint address="" binding="wsHttpBinding" bindingConfiguration="wsSecureBinding" name="secureService" contract="IISService.ILoyalty"/>  
     </service> 
    </services> 
    <behaviors> 
     <serviceBehaviors> 
     <behavior name="default"> 
      <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/> 
      <serviceDebug includeExceptionDetailInFaults="true"/> 
      <serviceCredentials> 
      <userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="IISService.SecurityValidation, IISService"/> 
      </serviceCredentials> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    <protocolMapping> 
     <add binding="basicHttpsBinding" scheme="https" /> 
    </protocolMapping> 
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" /> 
    </system.serviceModel> 

我也使用基本传输secuirty型号如此处所述http://www.c-sharpcorner.com/UploadFile/manas1/implementing-username-password-security-in-wcf-service/

在此先感谢您的帮助。

+0

只是疯狂的猜测:您尚未为您的站点托管IIS服务的站点配置了https,对不对? – khlr

回答