【发布时间】:2014-10-21 04:15:23
【问题描述】:
我的目标是确保MSMQ 队列管理器之间的通信安全——我不希望未知客户端向我的MSMQ 服务器发送消息。
我现在花了很多时间试图让Transport 安全工作为WCF 中的net.msmq 绑定工作,其中MSMQ 处于Workgroup 模式,客户端和服务器没有Active Directory...所以我正在使用证书。我创建了一个新的X.509 证书,名为Kristan,并将其放入服务器上的“Trusted people”存储区和客户端的Current User 我的存储区中。
我得到的错误是:
发送到队列时出错:
Unrecognized error -1072824272 (0xc00e0030).Ensure that MSMQ is installed and running. If you are sending to a local queue, ensure the queue exists with the required access mode and authorization。
使用 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);
队列在服务器上被标记为“已验证”。我已经检查了这个效果,如果我关闭客户端发送中的所有安全性,那么我会得到“签名无效”——这是可以理解的,表明它肯定在寻找一个 sig。
是否有我需要检查的特殊端口是否为基于证书的 msmq 身份验证打开?
【问题讨论】:
-
你解决过这个问题吗?我遇到了同样的问题,除了我也在使用 Message Security,这是我的挂断。
标签: wcf certificate msmq