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

WCF分布式开发常见错误(25):The certificate 'CN=WCFHTTPS' must have a private key that is capable of key exchange

在准备WCF安全开发实践编程系列文章的时候,制作证书出现这个问题。

The certificate 'CN=WCFHTTPS' must have a private key that is capable of key exchange. The process must have access rights for the private key.

证书必须有一个可以交换密钥的私钥,进程必须有访问私钥的权限。

【1】原因分析:

就是证书访问权限导致的问题,其次就是证书是否有密钥,因为要使用密钥 来解密消息。而且这个证书要安装受信任的机构里。

证书没有一个可以交换的私钥,我们需要重新制作证书。类型是 exchange.

【2】类似问题:

国内外也有很多网友遇到这个问题

有可能有办这个的参考文章:

http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/8e1c3feb- 56de-4366-8af5-3d526d4f4ce1/

http://social.msdn.microsoft.com/forums/en-US/wcf/thread/ac4a69d1- af3e-495c-8068-cb25ad0bb146/

http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/b1369589- 5207-4438-bcb8-2cade616bc0e

【3】解决办法:

在Visual Studio 命令行工具里启动命令行窗口,输入以下命令:

1.制作一个证书。制作证书:makecert -sr localmachine -ss My -n CN=MyServerCer -sky exchange -pe -r。http://msdn.microsoft.com/zh- cn/library/aa702761.aspx

exchange 表示密钥可以导入。

2.导出证书文件,带密钥的pfx文件。使用mmc

3.导入证书到信任的人。

4.导入证书到信任的机构,这个证书就被信任了。

这个问题WCF安全开发过程中会遇到,大家多注意。

参考文章:

http://social.microsoft.com/Forums/zh-CN/wcfzhchs/thread/857f4257- 8f43-4c7d-baa6-d2cabba36372

时间: 2024-05-19 12:04:56

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

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