【问题标题】:WCF/MSMQ Transport Security with Certificates带有证书的 WCF/MSMQ 传输安全性
【发布时间】: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


【解决方案1】:

看看http://www.controlsystemworks.com/articles/CertificateSecurityForWcfOverMsmq.html

我认为您需要设置客户端和服务器证书。

【讨论】:

    【解决方案2】:

    我有同样的问题,无法解决这个问题。但是,我收到的错误消息 0xc00e002c 略有不同,但情况相同 - 尝试将 Transport 安全性与 Certificate 一起使用,但它根本不起作用。如果我为消息安全使用相同的证书,它就可以正常工作。

    顺便说一句 - 如果我冒充ASPNET 进程以当前用户身份运行(拥有更多权限),一切都会按预期工作(没有错误)。我还找到了证书文件并将所有可能的permissions 添加到ASPNET 帐户,但这也无济于事。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-10-27
      • 2011-09-23
      • 1970-01-01
      • 1970-01-01
      • 2014-02-20
      • 1970-01-01
      • 2011-08-10
      • 2010-10-30
      相关资源
      最近更新 更多