dimanche 27 novembre 2011 12:19I have a service set up in iis 7.5 and the autostart will not start the application I have set up the autostart and always running attributes as well as the binding and protocol to net.pipe. Let me explain how the service is set up. I created a new website and it points to an empty directory. I added the application and it points to my actual application files (.config, svc, etc..). I have some initialization that needs to run before the first call as well as some timers that are needed for polling so i need it to start when iis is started. When i right click -> browse, the site initializes and everything works. But otherwise when i restart iis or recylce it does not start. Not sure what I'm missing Any advice is greatly appreciated. THX
Toutes les réponses
mercredi 30 novembre 2011 20:15
Did you also enable autoStart in the application pool that your service is running under?
To do this, do the following:
- In IIS Manager, select the server node.
- In the Features view, select the Configuration Editor.
- In the Configuration Manager, select the section system.applicationHost/applicationPools.
- Open the collection editor (button with 3 dots on the right when selecting (Collection) ).
- Select your application pool and set the autoStart property to True.
samedi 3 décembre 2011 15:06Yes It is set to true and is always running. I have the initialization code in the global asax as well as the constructor of the webservice but neither fire when a restart of the website or iis. I've read that the autostart does not create an instance of the web service class or fire the on application_start event in the global asax so i'm not sure where to put the code that would be fired when a reset happens.
samedi 3 décembre 2011 17:28
Global.asax doens't seem to be the right place for your initialization code in this case. You need to write your own autoStartProvider that contains your initialization code. Check these blog posts:
- Marqué comme réponse phuzzzed jeudi 8 décembre 2011 22:08
lundi 5 décembre 2011 17:27Thank you for the information. I'm trying to follow the the second link you provided. I added a class to one of my dll's and I'm trying to reference it in the
<serviceAutoStartProviders> node. The example on the link provided uses <add name="PreWarmMyCache" type="PreWarmCache, MyAssembly" />. I modified my application serviceautostartprovider to what I've named my provider and put in the name of my assembly but the default service looks like :
Microsoft.ApplicationServer.Hosting.AutoStart.ApplicationServerAutoStartProvider, Microsoft.ApplicationServer.Hosting, Version=18.104.22.168, Culture=neutral, PublicKeyToken=31bf3856ad364e35
Do i need the version/culture/etc... I don't have a publictoken because it is not strongly named. Do i need to strongly name it?
When i try to load with my custom provider it fails.
lundi 5 décembre 2011 18:29
You don't need to strong sign your assembly, but you do need to include the namespace in the configuration. Now you only have the class name in there.
<add name="PreWarmMyCache" type="MyAssembly.PreWarmCache, MyAssembly" />
See this example for reference:
jeudi 8 décembre 2011 22:07Thank you very much. This was the issue and It appears to be working.