简体   繁体   English

Windows Xp和Windows 7中的MSMQ,WCF和远程队列

[英]MSMQ, WCF and remote queue in Windows Xp and Windows 7

Why this console program (WCF host) work normally with remote queue (MSMQ) on Windows XP computer but not work on Windows 7? 为什么此控制台程序(WCF主机)在Windows XP计算机上可以与远程队列(MSMQ)一起正常使用,而在Windows 7上却不能使用? (.net Framework 4.5 (4.0 same situation)) (.net Framework 4.5(4.0相同的情况))

MSMQ Remote private queue (with messages) on Windows Server 2003 R2. Windows Server 2003 R2上的MSMQ远程专用队列(带有消息)。 One test client - Windows XP Prof. Second test client Windows 7 Prof. Identical config file on both machines. 一个测试客户端-Windows XP Prof.第二个测试客户端Windows 7 Prof.两台计算机上的配置文件相同。

MSMQ installed and started on all machines. MSMQ已在所有计算机上安装并启动。

I have a program host (console host) for WCF. 我有WCF的程序主机(控制台主机)。

 var host = new System.ServiceModel.ServiceHost (typeof (TestMessageReceiver ));
    host.Faulted += HostFaulted;
    host.Open();

Config file(part): 配置文件(部分):

<system.serviceModel>
    < services>
      < service behaviorConfiguration =" myBehavior" name="TestMSMQwin7.TestMessageReceiver" >
        < endpoint address="net.msmq://zzz.zzz.zzz.com/private/rbcmessagestest"
                   binding="netMsmqBinding"
                   bindingConfiguration="ReceiverMSMQconfig"
                   contract="RBC.Receiver.ContractInterfaces.IMessageReceiver" />
        < host>
          < baseAddresses>
            < add baseAddress="http://xxx.xxx.xxx.com:8089/MessageReceiver" />
          </ baseAddresses>
        </ host>
      </ service>
    </ services>
    < behaviors>
<!--...-->
    </ behaviors>
    < bindings>
      < netMsmqBinding>
        < binding name =" ReceiverMSMQconfig" maxReceivedMessageSize="5242880"   maxBufferPoolSize="5242880"  >
          < readerQuotas maxDepth =" 32" maxStringContentLength= "5242880 "   maxArrayLength="16384" maxBytesPerRead =" 4096" maxNameTableCharCount= "16384 "/>
          < security mode =" None" />
        </ binding>
      </ netMsmqBinding>
    </ bindings>
  </system.serviceModel>

And Question: why this console program (WCF host) connects and works great with the remote queue (receive messages) on a computer running OS Windows XP, but does not work on a computer running Windows 7? 和问题:为什么此控制台程序(WCF主机)在运行Windows XP的计算机上可以与远程队列(接收消息)连接并很好地工作,但在运行Windows 7的计算机上却不能工作?

On Windows 7 computer i have next exception ( host.Open();): 在Windows 7计算机上,我有下一个异常(host.Open();):

System.InvalidOperationException HResult=-2146233079 Message= Binding validation failed because the endpoint listen URI does not represent an MSMQ direct format name. System.InvalidOperationException HResult = -2146233079消息=绑定验证失败,因为端点侦听URI不代表MSMQ直接格式名称。 The service host cannot be opened. 服务主机无法打开。 Make sure you use a direct format name for the endpoint's listen URI. 确保对端点的侦听URI使用直接格式名称。 Source=System.ServiceModel 源= System.ServiceModel

A bit of googling revealed this: 进行了一些谷歌搜索发现:

http://rabblerule.blogspot.co.uk/2010/08/more.html http://rabblerule.blogspot.co.uk/2010/08/more.html

Which seems to say that you will get this error if the server hosting the endpoint is not running a lower version of MSMQ than your client. 这似乎表明,如果托管终结点的服务器运行的MSMQ版本低于客户端版本,则会出现此错误。

Which in your case the server is win2003 server, which will be running MSMQ 3.0 and the client is win7 which will be running MSMQ 5.0 ( see here for version table ). 在您的情况下,该服务器是win2003服务器,它将运行MSMQ 3.0,而客户端是win7,它将运行MSMQ 5.0( 有关版本表,请参见此处 )。

So you just need to use the same or more "similar" versions of MSMQ for service and client ends. 因此,您只需要为服务和客户端使用相同或更多“类似”的MSMQ版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM