2016-09-16 38 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

回答