Autostart not functioning as expected


  • I 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
    Sunday, November 27, 2011 12:19 PM


All replies

  • 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.

    Wednesday, November 30, 2011 8:15 PM
  • Yes 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.
    Saturday, December 03, 2011 3:06 PM
  • 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:




    • Marked as answer by phuzzzed Thursday, December 08, 2011 10:08 PM
    Saturday, December 03, 2011 5:28 PM
  • Thank 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=, 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.

    Monday, December 05, 2011 5:27 PM
  • 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: 


    Monday, December 05, 2011 6:29 PM
  • Thank you very much. This was the issue and It appears to be working.
    Thursday, December 08, 2011 10:07 PM