简体   繁体   English

WCF + SSL未找到端点

[英]WCF + SSL no endpoint found

I'm figthing for hours now to figure out this problem. 我现在已经好几个小时才弄明白这个问题了。

I have a wcf service that I host on II7, all works fine when I use the normal http protocol. 我有一个我在II7上托管的wcf服务,当我使用普通的http协议时,一切正常。

I added SSL capabilites and since then I cannot access it from code. 我添加了SSL功能,从那时起我无法从代码中访问它。 I can create a client but cannot run any of its methods. 我可以创建一个客户端但不能运行任何方法。

here is what I have 这就是我所拥有的

 <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>

I added a service reference to my project 我为我的项目添加了一个服务引用

and I use it like that 我就这样用它

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

and here is what I get 这就是我得到的

There was no endpoint listening at https://serverName.domname.local/WCFTest/MyWebService.svc that could accept the message. https://serverName.domname.local/WCFTest/MyWebService.svc上没有可以接受该消息的端点。 This is often caused by an incorrect address or SOAP action. 这通常是由错误的地址或SOAP操作引起的。 See InnerException, if present, for more details. 有关更多详细信息,请参阅InnerException(如果存在)。

Can anyone help me on this? 谁可以帮我这个事? I really do not understand what is going on... 我真的不明白发生了什么......

note: I can access the webservice correctly using Internet Explorer (so I guess my certificate is ok) 注意:我可以使用Internet Explorer正确访问Web服务(所以我猜我的证书没问题)

I think the server web.config might be the faulty one here. 我认为服务器web.config可能是错误的。 I've got WCF over SSL work with the following app.config on client side. 我在客户端使用以下app.config获得了WCF over SSL工作。

<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>

The only visible difference is ClientCredentialType which I have set to Windows as I want to use integrated windows authentication. 唯一可见的区别是我已设置为Windows的ClientCredentialType,因为我想使用集成的Windows身份验证。 The server web.config includes the following lines to setup the service which the client can consume. 服务器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>

Could you compare this to your web.config on the server side and see what differs? 你可以将它与服务器端的web.config进行比较,看看有什么不同吗? Or add your web.config to the question. 或者将web.config添加到问题中。

You were right about that, 你是对的,

Sg wrong on the server side. Sg在服务器端出错了。

here is how I made it working 这是我如何使它工作

<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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM