IIS7中托管的WCF MSMQ在我手动访问该服务之前没有自动检索消息

本文关键字:服务 访问 消息 自动检索 WCF MSMQ IIS7 | 更新日期: 2023-09-27 18:25:35

我看到了几篇与此相关的帖子,但我还没有找到问题的答案

因此,我有一个客户端使用WCF netmsmq绑定向MSMQ发送消息。这很好用。

我在本地IIS7(Windows 7)中托管了一个网站,该网站公开了WCF MSMQ端点。

当我从客户端发布消息时,消息不会被消耗,它们只是永远留在队列中UNTIL,我手动浏览服务,然后将消息发送到IIS 中托管的服务

那么,我需要做些什么才能由IIS中托管的WCF服务自动使用消息呢

注意:我刚刚注意到,在IIS中调用我的web应用程序中托管的任何WCF服务后,会唤醒该服务或其他东西,突然队列消息被消耗掉。。。

客户端配置

  <system.serviceModel>
    <client>
      <endpoint name="Service.ServiceContracts.QueueLoggingService NET MSMQ"
                address="net.msmq://localhost/private/Service.WebHost/QueueLoggingService.svc"
                binding="netMsmqBinding"
                contract="Service.ServiceContracts.IQueueLoggingService">
      </endpoint>
    </client>
    <bindings>
      <netMsmqBinding>
        <binding exactlyOnce="true" durable="true" maxRetryCycles="15" receiveRetryCount="15">
          <security mode="None">
            <message clientCredentialType="None" />
            <transport msmqAuthenticationMode="None" />
          </security>
        </binding>
      </netMsmqBinding>
    </bindings>
  </system.serviceModel>

服务器配置

  <system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true">
    </serviceHostingEnvironment>
    <services>
      <service name="Service.ServiceImplementations.QueueLoggingService">
        <endpoint 
                  address="net.msmq://localhost/private/Service.WebHost/QueueLoggingService.svc"
                  binding="netMsmqBinding"
                  contract="Service.ServiceContracts.IQueueLoggingService">
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
      </service>
    </services>
    <bindings>
      <netMsmqBinding>
        <binding exactlyOnce="true" durable="true" maxRetryCycles="15" receiveRetryCount="15">
          <security mode="None">
            <message clientCredentialType="None" />
            <transport msmqAuthenticationMode="None" />
          </security>
        </binding>
      </netMsmqBinding>
    </bindings>
  </system.serviceModel>

我尝试过的东西:

  • 消息队列服务正在运行
  • 消息队列触发器服务正在运行
  • Net.Msmmq侦听器适配器服务正在运行
  • Net.Pipe侦听器适配器服务正在运行
  • Net.Tcp侦听器适配器服务正在运行
  • Net.Tcp端口共享服务正在运行
  • 分布式事务协调器服务正在运行
  • MSMQ Active Directory域服务集成已安装
  • 已安装MSMQ HTTP支持
  • 已安装MSMQ触发器
  • 已安装MSMQ多播支持
  • 已安装WCF非HTTP激活
  • 已安装WCF HTTP激活
  • AppPool配置为自动启动
  • 我的默认网站包含以下配置:

            <application path="/Service.WebHost" applicationPool="MyGenericAppPool" enabledProtocols="net.msmq, http">
                <virtualDirectory path="/" physicalPath="C:'Some Path'Service.WebHost" />
            </application>
            <bindings>
                <binding protocol="http" bindingInformation="*:80:" />
                <binding protocol="net.tcp" bindingInformation="808:*" />
                <binding protocol="net.pipe" bindingInformation="*" />
                <binding protocol="net.msmq" bindingInformation="localhost" />
                <binding protocol="msmq.formatname" bindingInformation="localhost" />
            </bindings>
    

IIS7中托管的WCF MSMQ在我手动访问该服务之前没有自动检索消息

自动启动功能由AppFabric提供,因此您必须安装它。然后,您将能够使用类似于此的命令行来自动启动WAS应用程序:

appcmd.exe设置app/app.name:YourApplication/serviceAutoStartEnabled:True/serviceAutoSStartMode:All

OK

这家伙帮我节省了几个小时的预订时间:

Paul Bahler@paulbahler

事实证明,即使AppPool设置为自动启动。。。。这不是明显的。。。

所以这个家伙建议我安装AppFabric工具,然后只需配置应用程序即可自动启动并运行