Reputation: 1157
I've developed a WCF service that has only one operation("start") and once it's called, It actively Listens to a specific port.
I want to call this Operation every time the applicationpool is started. But i didn't find information about it.
I've search intensively through the net and what i found was instructions about how to autostart the service, which does not include how to call the WCF Service Operation on Applicationpool Start.
I tried two approaches yet:
One using a class with the appInitialize method inside the folder app_code of the deployed service. And in this class i called the start operation. Didn't work, but the appInitialize don't even get called.
step-by-step appInitialize method
The second approach was through configuration of the file applicationHosts.config to configure Auto-Start for the service. This also fails and the atribute "serviceAutoStartMode" were not recognized. However this is the start of the WCF Service and not WCF Service Operation call.
step-by-step configurating Auto-Start to a WCF Service
So my question is:
Is there any way of calling the WCF service operation on start of the application pool, iis, or other recommendable event?
Thanks in Advance
Upvotes: 0
Views: 1012
Reputation: 3757
If you're using IIS 7+ and have App Fabric installed, you can use AppFabric Auto-Start feature.
It's like Auto-Start you've read about, and it's easily configured in IIS. This link has a good example: appfabric-auto-start-feature
Hope it helps.
Upvotes: 1