MSMQ WCF hosted in IIS

蓝咒 提交于 2019-12-13 21:46:10

问题


I am stuck in the following case - I have two web applications – A and B. They are both running on the same computer. B is hosting a netMsmqBinding WCF Service. Also, B’s application pool has just recycled itself. A calls B’s WCF service. I see that the message has arrived in the private MSMQ queue which I have created. But until I don’t browse the *.svc URL the message is not proceed by B. Am I missing something required by this technology? What is the clean way to implement such a functionality? These are the configuration that I am using. If I missed some helpful info, please, tell me and I will provide it: The service (B):

<system.serviceModel>
    <services>
        <service name="MyProject.Web.Services.EmsListener">
            <endpoint address="net.msmq://localhost/private/myQueue"
                      binding="netMsmqBinding" bindingConfiguration="MyMsmqBinding"
                      contract="MyProject.Abstraction.IEmsListener">
            </endpoint>
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        </service>
    </services>




 <netMsmqBinding >
                <binding name="MyMsmqBinding"
                         durable="true"
                         receiveRetryCount="2"
                         maxRetryCycles="2"
                         retryCycleDelay="00:01:00"
                         receiveErrorHandling="Move" >
                    <security mode="None">
                        <message clientCredentialType="None"/>
                        <transport msmqAuthenticationMode="None" msmqProtectionLevel="None"  />
                    </security>
                </binding>
            </netMsmqBinding>

The client(A):

    <system.serviceModel>
        <bindings>
<netMsmqBinding>
                <binding name="MyBinding ">
                    <security mode="None" />
                </binding>
            </netMsmqBinding>
        </bindings>
        <client>        
            <endpoint address="net.msmq://localhost/private/myQueue" binding="netMsmqBinding"
                bindingConfiguration=" MyBinding " contract="EmsListener.IEmsListener"
                name=" MyBinding " />

        </client>
    </system.serviceModel>

Thanks in advance :)


回答1:


This may be because IIS is not starting your application after recycled.

Possible solution is to configure auto-start. Then IIS will start your service immediately without waiting for the first request.




回答2:


The possible solution of Imortist works!!

But first you need to add AppFabric to your ISS, then you need be sure you have the "Start Mode" option in your pool advance settings.

Note: In my windows 7 IIS7 didnt work, but in my windows server 2012 R2 IIS8 Works perfectly



来源:https://stackoverflow.com/questions/22617449/msmq-wcf-hosted-in-iis

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!