2009-04-28 62 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添加到问题中。