具有证书的WCF/MSMQ传输安全性
我的目标是确保具有证书的WCF/MSMQ传输安全性,wcf,certificate,msmq,Wcf,Certificate,Msmq,我的目标是确保MSMQ队列管理器之间的通信安全–我不希望未知客户端向我的MSMQ服务器发送消息 我现在花了很多时间试图在WCF中的net.msmq绑定中获得Transport安全性,其中msmq处于Workgroup模式,客户端和服务器没有activedirectory…因此我正在使用证书。我已经创建了一个新的X.509证书,名为Kristan,并将其放入服务器上的“可信人”存储区和客户端的当前用户的我的存储区 我得到的错误是: 发送到队列时出错:无法识别的错误-1072824272(0xc00
MSMQ
队列管理器之间的通信安全–我不希望未知客户端向我的MSMQ
服务器发送消息
我现在花了很多时间试图在WCF
中的net.msmq
绑定中获得Transport
安全性,其中msmq
处于Workgroup
模式,客户端和服务器没有activedirectory
…因此我正在使用证书。我已经创建了一个新的X.509
证书,名为Kristan
,并将其放入服务器上的“可信人
”存储区和客户端的当前用户
的我的存储区
我得到的错误是:
发送到队列时出错:无法识别的错误-1072824272(0xc00e0030)。请确保MSMQ已安装并正在运行。如果要发送到本地队列,请确保该队列具有所需的访问模式和授权
使用smartsniff,我发现没有尝试连接远程MSMQ
,但是,这可能是来自本地队列管理器的错误。堆栈跟踪是:
at System.ServiceModel.Channels.MsmqOutputChannel.OnSend(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.OutputChannel.Send(Message message, TimeSpan timeout)
at System.ServiceModel.Dispatcher.OutputChannelBinder.Send(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
守则:-
EndpointAddress endpointAddress = new EndpointAddress(new Uri(endPointAddress));
NetMsmqBinding clientBinding = new NetMsmqBinding();
clientBinding.Security.Mode = NetMsmqSecurityMode.Transport;
clientBinding.Security.Transport.MsmqAuthenticationMode = MsmqAuthenticationMode.Certificate;
clientBinding.Security.Transport.MsmqProtectionLevel = System.Net.Security.ProtectionLevel.Sign;
clientBinding.ExactlyOnce = false;
clientBinding.UseActiveDirectory = false;
// start new
var channelFactory = new ChannelFactory<IAsyncImportApi>(clientBinding, endpointAddress);
channelFactory.Credentials.ClientCertificate.SetCertificate("CN=Kristan",
StoreLocation.CurrentUser,
StoreName.My);
EndpointAddress EndpointAddress=新的EndpointAddress(新Uri(EndpointAddress));
NetMsmqBinding clientBinding=新的NetMsmqBinding();
clientBinding.Security.Mode=NetMsmqSecurityMode.Transport;
clientBinding.Security.Transport.MsmqAuthenticationMode=MsmqAuthenticationMode.Certificate;
clientBinding.Security.Transport.MsmqProtectionLevel=System.Net.Security.ProtectionLevel.Sign;
clientBinding.ExactlyOnce=false;
clientBinding.UseActiveDirectory=false;
//重新开始
var channelFactory=新的channelFactory(clientBinding,endpointAddress);
channelFactory.Credentials.ClientCertificate.SetCertificate(“CN=Kristan”,
StoreLocation.CurrentUser,
StoreName.My);
该队列在服务器上标记为“已验证”。我已经检查了它的效果,如果我关闭客户端发送中的所有安全性,那么我会得到“签名无效”——这是可以理解的,并且表明它肯定在寻找sig
是否有我需要检查的特殊端口是否为基于证书的msmq身份验证打开?请查看
我认为您需要同时设置客户端和服务器证书。我也有同样的问题,无法解决这个问题。然而,我得到的错误消息略有不同,但情况是一样的-尝试使用
传输安全性和证书但根本不起作用。如果我使用相同的证书作为消息安全性,它就可以正常工作
顺便说一句-如果我模拟ASPNET
进程以当前用户身份运行(拥有更多权限),一切都会按预期运行(没有错误)。我还找到了证书文件,并向ASPNET
帐户添加了相同的所有可能的权限,但这也没有任何帮助。您解决过这个问题吗?我也有同样的问题,除了我也在使用消息安全性,这就是我的问题所在。