question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

2.2.0 IIS Hosting Bundle 500.30 error when setting web.config ASPNETCORE_ENVIRONMENT

See original GitHub issue

Describe the bug

We get a HTTP Error 500.30 - ANCM In-Process Start Failure after upgrading to asp.net core 2.2

To Reproduce

Steps to reproduce the behavior:

  1. Install the latest Windows 2.2.0 hosting bundle (aspnetcore.dll 12.2.18316) on Windows server
  2. Create an asp.net core 2.2 web app with inprocess hosting
  3. Add a 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>
    <handlers>
      <remove name="aspNetCore" />
      <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
    </handlers>
    <aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="InProcess"/>
  </system.webServer>
</configuration>
  1. Run the site using IIS Express
  2. Verify environment variables were added to your web.config:
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="InProcess">
      <environmentVariables>
        <environmentVariable name="ASPNETCORE_HTTPS_PORT" value="44368" />
        <environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />
      </environmentVariables>
    </aspNetCore>
  1. On the server, create the site in IIS and then set an ASPNETCORE_ENVIRONMENT variable in machine-wide IIS applicationhost.config for the site
  2. Publish to the server and hit the site
  3. See the error
  4. I verified that if I remove the web.config environmentVariable named ASPNETCORE_ENVIRONMENT the site loads. Adding other web.config environment variables does not cause any problems.

Expected behavior

The site should start

Additional context

We set our ASPNETCORE_ENVIRONMENT environment variables for our sites in IIS applicationhost.config. I got the error for a site with “STAGING” set in applicationhost.config. I verified that even if I set the same value to “STAGING” in web.config the site will not start.

We use shared applicationhost.config, but I don’t think that’s pertinent.

The issue could obviously be duplicated without running the site in IIS Express first - as long as the ASPNETCORE_ENVIRONMENT variable is in web.config the site will not be able to startup on the server if that variable is also set in applicationhost.config. I have not confirmed that the site works if there is no ASPNETCORE_ENVIRONMENT variable set for the site in applicationhost.config.

If there is no web.config in the Visual Studio project or if a default one is added which is all commented out a web.config is not created or modified when running the site in IIS Express.

This did not error in asp.net core 2.1.

I enabled logging in web.config and added a logs folder and a stdout logfile was created but it was empty.

I worked around this by removing the environment variable from web.config before publishing.

Cross-reference: https://github.com/aspnet/Docs/issues/10046

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
mokthcommented, May 10, 2019

just go cmd, go to u side folder. run dotnet <u api.dll> as u found on the web.config. then u will found what error. for me… it the damm shit connection string the "", need to put “\”

1reaction
guardrexcommented, Dec 20, 2018

@pakrym Just want to make sure you see 👁️ this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ASP.NET Core fails to run under IIS: HTTP Error 500.0
I solve this error just by changing in the web.config AspNetCoreModuleV2 to AspNetCoreModule, but this is not perfect solution. Another solution ...
Read more >
Troubleshoot ASP.NET Core on Azure App Service and IIS
Installing or repairing the installation of the .NET Core Hosting Bundle (for IIS) or Visual Studio (for IIS Express) may fix the problem....
Read more >
ASP.NET Core IIS InProcess Hosting Issue in .NET Core 3.1
I ran into a nasty issue yesterday related to hosting an ASP.NET Core 3.1 server application in IIS using the default InProcess hosting....
Read more >
HTTP Error 500.30 - ASP.NET Core app failed to start help
This means that something happened during the initialization of your app, why you won't even be able to launch any of your web...
Read more >
HTTP Error 500.0 - ASP.NET Core IIS hosting failure (in- ...
installed dot net core 6 runtime environment and dotnet hosting 6. But still getting this error when i'm trying to run website.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found