I have an ASP.NET 3.1 project that get published to a windows server. When I run the project locally on my computer, it works fine; however, when I remote desktop into that windows server, I am getting a 500 error in the network tab and the following error:
I have changed my environment variable to Development in my Launch.json file, but still received the same error
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
When I looked in windows Event Viewer, I found this error: Can someone help me figure out what is going on with this?
Please check the value of ASPNETCORE_ENVIRONMENT variable. You will have to set this environment variable to "Production"(or other environment than Development).
Otherwise, you can update web.config like this:
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath=".\Application.exe" arguments="" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false">
<environmentVariables>
<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Production" />
</environmentVariables>
</aspNetCore>
</system.webServer>
</configuration>
Refer this post for more details.