2010-03-27 126 views
2

我的目标是确保MSMQ队列管理器之间的通信 - 我不想未知客户端发送邮件到我的MSMQ服务器。WCF/MSMQ传输安全使用证书

我花了很多时间,现在试图获得的net.msmqTransport安全工作在WCF,其中MSMQWorkgroup模式,客户端和服务器绑定没有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); 

队列被标记为在服务器上“证实的”。我已经检查了这个效果,如果我关闭客户端发送的所有安全性,那么我会得到'签名无效' - 这是可以理解的,并且显示它肯定正在寻找签名。

是否有我需要检查是开放的基于证书,MSMQ权威性特殊端口?

+0

你有没有得到这个工作?我有同样的问题,除了我也使用消息安全,这是我的挂断。 – Random 2013-03-29 17:06:00

回答

0

我有同样的问题,无法弄清楚。但是,我得到了稍微不同的错误消息0xc00e002c,但情况相同 - 尝试使用Transport安全性与Certificate但它根本不起作用。如果我使用相同的证书来保护邮件安全,它可以正常工作。

顺便说一句 - 如果我冒充ASPNET过程为当前用户(其中​​有更多的权利)一切正常(没有错误)运行。我还找到了证书文件,并将所有可能的permissions添加到ASPNET帐户,但这也没有帮助。