2.2.0 IIS Hosting Bundle 500.30 error when setting web.config ASPNETCORE_ENVIRONMENT
See original GitHub issueDescribe 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:
- Install the latest Windows 2.2.0 hosting bundle (aspnetcore.dll 12.2.18316) on Windows server
- Create an asp.net core 2.2 web app with inprocess hosting
- 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>
- Run the site using IIS Express
- 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>
- On the server, create the site in IIS and then set an
ASPNETCORE_ENVIRONMENT
variable in machine-wide IISapplicationhost.config
for the site - Publish to the server and hit the site
- See the error
- 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:
- Created 5 years ago
- Comments:10 (5 by maintainers)
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 “\”
@pakrym Just want to make sure you see 👁️ this.