2012-01-13 123 views
0

我沒有任何成功在現有的WCF服務上在我的開發環境中設置HTTPS。 http服務一直很好。我正在使用hosts文件重定向到本地主機,它一直在爲http工作。WCF配置與https

我的Web服務配置

<services> 
    <service name="EnfieldWebService"> 
    <endpoint address="https://enfieldwebservice.devserver.int/EnfieldWebService.svc" 
    binding="basicHttpBinding" bindingConfiguration="transportSecurity" /> 
    </service> 
</services> 
<bindings> 
    <basicHttpBinding> 
    <binding name="transportSecurity"> 
     <security mode="Transport"> 
     </security> 
    </binding> 
    </basicHttpBinding> 
</bindings> 

客戶端配置

<bindings> 
     <basicHttpBinding> 
      <binding name="BasicHttpBinding_IEnfieldWebService" closeTimeout="00:01:00" 
       openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" 
       allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" 
       maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" 
       messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" 
       useDefaultWebProxy="true"> 
       <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" 
        maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 
       <security mode="Transport"> 
        <transport clientCredentialType="None" proxyCredentialType="None" 
         realm="" /> 
        <message clientCredentialType="UserName" algorithmSuite="Default" /> 
       </security> 
      </binding> 
     </basicHttpBinding> 
    </bindings> 
    <client> 
     <endpoint address="https://enfieldwebservice.devserver.int/EnfieldWebService.svc" 
      binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IEnfieldWebService" 
      contract="HttpsEnfieldService.IEnfieldWebService" name="BasicHttpBinding_IEnfieldWebService" /> 
    </client> 

和單元測試結果:

System.ServiceModel.EndpointNotFoundException: There was no endpoint listening at https://enfieldwebservice.devserver.int/EnfieldWebService.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details. ---> System.Net.WebException: The remote server returned an error: (404) Not Found.

回答

0

二手WCF配置編輯器基本上重寫相同的配置。它刪除的所有內容是

<serviceHostingEnvironment multipleSiteBindingsEnabled="true" /> 

原來這個功能只與http兼容,並且打破了https。

+0

如果您列出了多項服務,該怎麼辦? – DazManCat 2012-05-21 11:24:44