我想了好几个小时来解决这个问题。
我有一个托管在II7上的wcf服务,当我使用普通的http协议时,所有服务都可以正常工作。
我添加了SSL能力,从那时起我就无法从代码中访问它。我可以创建一个客户机,但不能运行它的任何方法。
这是我有的东西
<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
这就是我得到的
没有侦听https://serverName.domname.local/WCFTest/MyWebService.svc的端点可以接受消息。这通常是由不正确的地址或SOAP操作造成的。有关更多细节,请参见InnerException (如果存在)。
有人能帮我吗?我真的不明白发生了什么..。
注意:我可以使用Internet正确地访问can服务(所以我想我的证书是可以的)
发布于 2009-04-28 06:59:54
你说得对,
服务器端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>
发布于 2009-04-28 06:49:41
我认为服务器web.config可能是这里的错误之一。我已经在客户端使用下面的app.config处理work。
<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添加到问题中。
https://stackoverflow.com/questions/797903
复制相似问题