After publishing a working EF Core App (NetCore 3.1) to Azure, I get this message, "Error An error occurred while processing your request" It goes on to say swapping ASPNETCORE_ENVIRONMENT to Development will show information about error. However, it runs without an error on Visual Studio Debug and Run without Debug. Before publishing, I changed the connection string to "DefaultConnection" in appsettings.json and startup.cs
0
votes
1 Answers
0
votes
The "error message" is not the actual error message, its just notifying you that there's an error. Since the environment is set as production when publishing, it is not going to show the actual error since it may be sensitive and show parts of your code, you need to switch to development mode to see it.
If you can edit your web.config file, it is usually the last file in the your publish folder; replace this line
<aspNetCore processPath="dotnet" arguments=".\yourapplicationname.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="InProcess"\>
with;
<aspNetCore processPath="dotnet" arguments=".\yourapplicationname.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="InProcess" >
<environmentVariables>
<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />
</environmentVariables>
</aspNetCore>
this swaps the environment to development mode so when you run your app again, it would give you the error itself and you can solve them.
i would advise publishing locally on to a folder and setting up your application on IIS to test locally before publishing to azure if you're using windows.