2

I have an issue with an ASP.NET Core 3.1 web app. I need this app to start automatically when it crashes or server restarts without waiting for the next user to login so that it starts.
For this I set the Application Pool Start Mode to AlwaysRunning, Idle Time-out setting to 0, Regular Time Interval to 0 and on the web site have set the Preload Enabled to True.
That works on all servers that we have except for one server that I can see that the w3wp process starts but not the asp.net core app if I restart the Application Pool or restart the machine. I don't see any errors in the event viewer.

What might be causing this or how can I troubleshoot it further?

3
  • Are all servers running exactly the same version of Windows? Maybe one of them is on an older version where the feature ether isn't present, is misconfigured, or has a bug compared to the others? Commented Feb 4, 2021 at 10:22
  • All servers running the same version of windows. Commented Feb 4, 2021 at 10:30
  • Use in-process hosting mode please. Commented Feb 4, 2021 at 19:35

1 Answer 1

1

I have same issue on Windows 10 and IIS version is 10. This solution works for me:

On Windows 7 or later desktop systems when using IIS locally: Navigate to Control Panel > Programs > Programs and Features > Turn Windows features on or off (left side of the screen). Open Internet Information Services > World Wide Web Services > Application Development Features. Select the checkbox for Application Initialization.

Using web.config, add the element with doAppInitAfterRestart set to true to the <system.webServer> elements in the app's web.config file add this section

 <system.webServer>
      <applicationInitialization doAppInitAfterRestart="true" />
 </system.webServer>

After that you must change applicationHost.config two section change C:\Windows\System32\inetsrv\config\applicationHost.config

First section below:

<site name="yoursitename" id="3" serverAutoStart="true">
    <application path="/" applicationPool="yoursitename" preloadEnabled="true" serviceAutoStartEnabled="true" serviceAutoStartProvider="ApplicationPreload">
        <virtualDirectory path="/" physicalPath="C:\websites\yoursitename" />
    </application>
    <bindings>
        <binding protocol="http" bindingInformation="*:8011:" />
    </bindings>
</site>

Second section below:

<add name="yoursitename" autoStart="true" startMode="AlwaysRunning">
    <processModel idleTimeout="00:00:00" />
       <recycling>
        <periodicRestart time="00:00:00" />
    </recycling>
</add>

PS: if you want to stop the project completely you must stop in application pool.

Source: https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/advanced?view=aspnetcore-6.0#application-initialization-module

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.