WCF分布式开发常见错误(27)

WCF分布式开发常见错误(27):Secure channel cannot be opened because security negotiation with the remote endpoint has failed

这个问题是在调试WCF分布式安全开发实践(12):消息安全模式之自定义X509 证书验证:Message_CustomX509Certificate_WSHttpBinding 。发现并提出来的 ,我帮助调试,找到了问题的解决办法。发出来一起分享给大家。

【1.问题描述】:

1.项目类型:IIS托管的WCF服务。

2.安全类型:消息安全模式+ 自定义X509证书验证。+WSHttpBinding :Message_CustomX509Certificate_WSHttpBinding

3.客户端类型:ASP.NET 网站。

4.错误信息:Secure channel cannot be opened because security negotiation with the remote endpoint has failed. This may be due to absent or incorrectly specified EndpointIdentity in the EndpointAddress used to create the channel. Please verify the EndpointIdentity specified or implied by the EndpointAddress correctly identifies the remote endpoint.

安全通道无法打开,因为安全与远程终结 点协商已经失败。这可能是由于在EndpointAddress 缺少或不正确指定用于创建 通道的EndpointIdentity。请验证EndpointIdentity指定或暗示的 EndpointAddress正确标识远程终结点。

5.错误截图:

【2.问题分析】:

导致这个问题的可能原因有2个:

(1)没有服务端配置安全选项。

(2)服务没有启动。

网上的同样的问题也很多,但是没有什么帮助。这里针对2个Web类型的应用 项目。在调试的时候容易出现这样的问题。

【3.解决方案】:

原因(1):

检查服务配置,证书设置:

<wsHttpBinding>
                <binding name="MyBindingConfigration">
                    <security mode="Message">
                        <transport 

clientCredentialType="None"/>
                        <message 

clientCredentialType="Certificate"/>
                    </security>
                </binding>
</wsHttpBinding>

原因(2):由于一个解决方案里包含2个项 目,所以要保证服务启动。步骤如下:

这个问题的关键在于,你虽然设置了证书,这里错误提示是,与服务终结点 协商失败,原因不是证书。

是整数标识的服务,没有启动,导致协商错误。你右键-》Debug->启动新 的实例,先把服务启动。

然后在右键-》Debug->启动新的客户端项目实例。这样单步调试就通过了 。

我把证书名称换为我本机的证书,你记得根据自己的证书名称修改配置文件 。

参考链接:

http://social.microsoft.com/Forums/zh-CN/wcfzhchs/thread/f1d4e572- 5871-48da-8dc3-8195a42f7c94

以上是小编为您精心准备的的内容,在的博客、问答、公众号、人物、课程等栏目也有的相关内容,欢迎继续使用右上角搜索按钮进行搜索问题
, 安全
, 分布式
, 错误
, 证书
, 服务
wshttpbinding
wcf分布式开发、wcf分布式架构、wcf 分布式、wcf 分布式事务、wcf 分布式负载均衡,以便于您获取更多的相关知识。

时间: 2024-09-08 11:34:59

WCF分布式开发常见错误(27)的相关文章

WCF分布式开发常见错误

WCF分布式开发常见错误(30) WCF分布式开发常见错误(29) WCF分布式开发常见错误(28) WCF分布式开发常见错误(27) WCF分布式开发常见错误(26) WCF分布式开发常见错误(25) WCF分布式开发常见错误(24) WCF分布式开发常见错误(23) WCF分布式开发常见错误(22) WCF分布式开发常见错误(21) WCF分布式开发常见错误(20):TimeoutException was unhandled WCF分布式开发常见错误(19) WCF分布式开发常见错误(18

WCF分布式开发常见错误(19)

WCF分布式开发常见错误(19):There was an error opening the queue打开消息队列出错 在调试托管宿主 WCF MSMQ消息队列代码的时候出现错误: There was an error opening the queue. Ensure that MSMQ is installed and running, the queue exists and has proper authorization to be read from. The inner exc

WCF分布式开发常见错误(15)

WCF分布式开发常见错误(15):Communication with the underlying transaction manager has failed 今天本地调试WCF事务的时候出现这个错误:Communication with the underlying transaction manager has failed. 搜索了很多资料,查找原因.是因为MSDTC的问题.此协议要使用分布式事务协调器. 或者是事务协议的问题. 解决办法: 修改事务通信协议. <bindings>

WCF分布式开发常见错误(13)

WCF分布式开发常见错误(13):The transaction under which this method call was executing ,此方法调用的事务被异步中断 今天WCF事务编程的时候遇到这个错误:The transaction under which this method call was executing was asynchronously aborted.此方法调用的事务被异步中断. 错误截图如下: 原因可能由多个.我查询了很多资料.国内论坛很少有人讨论这个问题

WCF分布式开发常见错误解决(12)

WCF分布式开发常见错误解决(12):The server was unable to process the request,服务无法处理请求 进行WCF编程过程中会遇到这样的错误:服务无法处理的请求由于内部错误. 具体信息如下: The server was unable to process the request due to an internal error. For more information about the error, either turn on IncludeEx

WCF分布式开发常见错误解决(11)

WCF分布式开发常见错误解决(11):There is already a listener on IP endpoint ,IP 终结点 已经存在侦听器 进行WCF服务终结点配置的过程中,当你配置服务终结点端口,启动服务程序的时候会遇到如下错误,服务无法启动,1.错误信息如下: IP终结点(端口) 0.0.0.0:8002已经存在一个侦听器,请确保程序中没有多次使用一个终结点,或别的程序没有监听此终结点(端口) There is already a listener on IP endpoin

WCF分布式开发常见错误解决(10)

WCF分布式开发常见错误解决(10):套接字连接中断,The socket connection was aborted (使用Windows Service作为宿主的时候也会出现这样的情况,搜索的) 我们这里是自定义托管宿主,在进行WCF编程开发过程时,使用NetTcpBinding绑定协议,作为通讯协议,可能会引发这样的异常,导致数据如法传输.套接字连接中断,可能是由于消息处理错误,或者远程宿主接受超时引起,或者是底层网络资源问题导致,本地套接字时间是'00:00:59.7656250'.具

WCF分布式开发常见错误解决(9)

WCF分布式开发常见错误解决(9):无终结点监听,There was no endpoint listening at 当我们添加服务元数据地址,查找元数据服务,进行反序列操作.会出现这样的错误:无终结点监听Metadata contains a reference that cannot be resolved: 'net.tcp://localhost:9004/mex'. There was no endpoint listening at net.tcp://localhost:9004

WCF分布式开发常见错误解决(7)

WCF分布式开发常见错误解决(7):System.InvalidOperationException,Cannot have two operations in the same contract 我们启动服务宿主程序的时候,有可能出现如下的无效操作异常,信息如下: Cannot have two operations in the same contract with the same name, methods SayHello and SayHello in type WCFService