2009-04-28 68 views
12

我想了幾個小時來解決這個問題。WCF + SSL沒有找到終點

我有一個wcf服務,我主持在II7,所有工作正常,當我使用正常的http協議。

我添加了SSL capabilites,從那時起我無法從代碼訪問它。我可以創建一個客戶端,但不能運行任何方法。

這裏是我

<system.serviceModel> 
    <bindings> 
     <wsHttpBinding> 
      <binding name="WSHttp0"> 
       <security mode="Transport"> 
        <transport realm ="" clientCredentialType="None" /> 
       </security> 
      </binding> 
     </wsHttpBinding> 
    </bindings> 
    <client> 
     <endpoint address="https://serverName.domname.local/WCFTest/MyWebServicec.svc" 
      binding="wsHttpBinding" bindingConfiguration="WSHttp0" contract="SSLWebService.IMyWebService" 
      name="WSEP"> 
      <identity> 
       <dns value="serverName.domname.local" /> 
      </identity> 
     </endpoint> 
    </client> 
</system.serviceModel> 

我添加了一個服務引用到我的項目

我用它像

Dim client As MyWebServiceClient = New MyWebServiceClient() 
Try 
    client.GetDocumentByDocID(5) 
Catch ex As Exception 
    MessageBox.Show(ex.Message) 
End Try 

,這裏是我所得到的

在01處沒有端點收聽可以接受該消息。這通常是由不正確的地址或SOAP操作引起的。有關更多詳細信息,請參閱InnerException(如果存在)。

任何人都可以幫助我嗎?我真不明白是怎麼回事...

注:我可以訪問正確使用Internet Explorer(所以我想我的證書是確定)

+0

它可能是有益的,看看服務器配置 – 2009-04-28 14:42:09

回答

3

你說的對,

Sg在服務器端錯誤。

這裏是我如何做它的工作

<system.serviceModel> 
    <bindings> 
     <wsHttpBinding> 
      <binding name="wsHttpEndpointBinding"> 
       <security mode="Transport"> 
        <transport clientCredentialType ="None"/> 
       </security> 
      </binding> 
     </wsHttpBinding> 
    </bindings> 
    <services> 
     <service behaviorConfiguration="App_WcfWebService.AppWebServiceBehavior" name="App_WcfWebService.AppWebService"> 
      <endpoint address="" binding="wsHttpBinding" bindingConfiguration ="wsHttpEndpointBinding" contract="App_WcfWebService.IAppWebService"> 

      </endpoint> 
      <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/> 
     </service> 
    </services> 
    <behaviors> 
     <serviceBehaviors> 
      <behavior name="App_WcfWebService.AppWebServiceBehavior"> 
       <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --> 
       <serviceMetadata httpsGetEnabled="true"/> 
       <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --> 
       <serviceDebug includeExceptionDetailInFaults="true"/> 
       <serviceThrottling maxConcurrentSessions="90" />      
      </behavior> 
     </serviceBehaviors> 
    </behaviors> 
</system.serviceModel> 
4

我認爲服務器的web.config可能是web服務錯誤的在這裏。我已經通過SSL與WCF通過以下app.config在客戶端工作。

<configuration> 
    <system.serviceModel> 
    <bindings> 
     <wsHttpBinding> 
     <binding name="WSHttpBinding_IService" > 
      <security mode="Transport"> 
      <transport realm ="" clientCredentialType="Windows" /> 
      </security> 
     </binding> 

     </wsHttpBinding> 
    </bindings> 
    <client> 
     <endpoint address="https://mycomputer/Service/Service.svc" 
      binding="wsHttpBinding" 
      bindingConfiguration="WSHttpBinding_IService" 
      contract="ServiceProxy.IService" name="WSHttpBinding_IService"> 
     <identity> 
      <dns value="mycomputer" /> 
     </identity> 
     </endpoint> 
    </client> 
    </system.serviceModel> 
</configuration> 

唯一可見的區別是ClientCredentialType,我將其設置爲Windows,因爲我想使用集成的Windows身份驗證。服務器web.config包含以下行來設置客戶端可以使用的服務。

<system.serviceModel> 
    <bindings> 
     <wsHttpBinding> 
     <binding name="WindowsBinding"> 
      <security mode="Transport"> 
      <transport proxyCredentialType="Windows" /> 
      </security> 
     </binding> 
     </wsHttpBinding> 
    </bindings> 
    <services> 
     <service behaviorConfiguration="Service.Service1Behavior" 
       name="Service.Service"> 
     <endpoint address="" binding="wsHttpBinding" 
        bindingConfiguration="WindowsBinding" 
        contract="ServiceInterface.IService"> 
      <identity> 
      <dns value="mycomputer" /> 
      </identity> 
     </endpoint> 
     </service> 
    </services> 
    <behaviors> 
     <serviceBehaviors> 
     <behavior name="Service.Service1Behavior"> 
      <serviceMetadata httpGetEnabled="true"/> 
      <serviceDebug includeExceptionDetailInFaults="false"/> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    </system.serviceModel> 

你可以將它與服務器端的web.config進行比較,看看有什麼不同嗎?或者將你的web.config添加到問題中。