Click here to Skip to main content
15,885,757 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
I have two WCF services, which use the net.msmq protocol and hosted in IIS 7.
My problem is that the services do not activate when a new message appears on the queue. We have to manually browse the services first before they start picking up any messages.

Is there any way to auto activate these services?

Thanks in advance for any help.
Posted
Updated 11-Jul-13 2:03am
v2
Comments
Mohammed Hameed 11-Jul-13 8:06am    
Though it is a good question but I suggest you to try solving yourself. For this, you might have to understand how MSMQ works in Wcf.
saumil.sapariya 11-Jul-13 8:14am    
I should notice that it appears when application pool (IIS) recyled.If you have suggestion plz provide :)

1 solution

This is do-able with the combination of .Net 4 and IIS7.5.

First you need to auto start the application pool.

Configure Automatic Startup for an Application Pool (IIS 7)[^]

Then you need to configure the application to auto start:

Auto-Start ASP.NET Applications (VS 2010 and .NET 4.0 Series)[^]

If you don't have access to these components then you'll be required to keep the application alive by other means. Such as the following code snippet in a windows service:

C#
WebClient refresh = new WebClient();
try {
    refresh.UploadString("http://www.website.com/", string.Empty);
}
catch (Exception ex) {
    //snip...
}
finally {
    refresh.Dispose();
}


Which I got from this article, discussing the keep alive problem.

Keep Your Website Alive (Don’t Let IIS Recycle Your Website)![^]

There are a number of settings on the IIS application pool which control recycling of the worker processes.

Understanding these can also help reduce the number of times the application shuts down.

Recycling Settings for an Application Pool[^]

Although if you want my advice. I'd completely drop IIS and develop a self hosted WCF application. Then the problem will just disappear.

How to: Host a WCF Service in a Managed Application[^]
 
Share this answer
 
v4

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900