10

I have .NET Core 3.1 API which is deployed in Azure web application service. I had trouble running the application in Azure because of the error 500.37 ANCM Failed to Start Within Startup Time Limit. I managed to solve this issue by increasing startupTimeLimit in web.config (as you can see below).

But Now, when I'm running 2 instances in Azure web app service. One of the instances works just fine but the other one still has the same error.

Any ideas on how How to set startupTimeLimit for multiple instances in IIS?

web.config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <!-- To customize the asp.net core module uncomment and edit the following section. 
  For more info see https://go.microsoft.com/fwlink/?linkid=838655 -->
  <system.webServer>
    <httpProtocol>
      <customHeaders>
        <remove name="X-Powered-By" />
      </customHeaders>
    </httpProtocol>
    <handlers>
      <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
    </handlers>
    <aspNetCore processPath="dotnet" arguments=".\Clients.Api.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" startupTimeLimit="180" hostingModel="inprocess" >
    </aspNetCore>
  </system.webServer>
</configuration>

Edit:

I used azure web app Scale out (App Service plan) to increase the running instance to 2.

Melchia
  • 22,578
  • 22
  • 103
  • 117

4 Answers4

8

We solved this solution by increasing the startupTimeLimit to 300

<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
  <location>
    <system.webServer>
      <aspNetCore xdt:Transform="SetAttributes(startupTimeLimit)" startupTimeLimit="300">
      </aspNetCore>
    </system.webServer>
  </location>
</configuration>
Melchia
  • 22,578
  • 22
  • 103
  • 117
4

Finally I was able to fix this error.

It is a configuration error (.net core configuration). Azure App Services need an additional configuration of the project when it is in .net core 3.1. The solution is:

  • In project file (asp.net or web api project) (*.proj) you have to place the following line just below TargetFramework:

<AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>

Final *.proj file would be something like this :

<Project Sdk="Microsoft.NET.Sdk.Web">  <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>        
    <AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>
    <UserSecretsId>my-secrets-go-here</UserSecretsId>
    <Version>1.1.0.0</Version>
    <Authors>me</Authors>
    <Company>TheCompany</Company>
    <Platforms>AnyCPU;x64</Platforms>
  </PropertyGroup>
  ...
</Project>

And that's it. After adding those changes and uploading a new version on your Azure App Service the application is going to be executed without errors (unless there's something else related to your code).

I was able to replicate this error by executing my project directly on IIS from my local, when you do that VS opens the web browser but the web page is never loaded.

0

Started getting this error when running my .net core 3.1 application on production. The error occurs immediately after updating the application. However, for me, running iisreset on cmd was enough to solve the error.

-2

if application work perfect on development machine and this error exist on your production server that is not connected to internet

check event log and find if you have any error like this:

Failed extract of third-party root list from auto update cab at

you need just update server certificates

  1. with Online option : connect server to internet
  2. with Offline option: follow this guide
Mahdi
  • 649
  • 8
  • 18