After publishing my .net core 2 app on IIS 7.5 I get this error:
an error occurred while starting the application.
Is there any way to force dot net core to submit a accurate error message rather than such general message?
After publishing my .net core 2 app on IIS 7.5 I get this error:
an error occurred while starting the application.
Is there any way to force dot net core to submit a accurate error message rather than such general message?
You can try to start your application directly on your IIS Server via the console.
dotnet myapp.dll
You should get a much more verbose error there.
I found this link helpful: How to troubleshoot: “An error occurred.... In summary:
<aspNetCore>
element of your web.config
, set stdoutLogEnabled
to true
.<aspNetCore processPath=".\myapp.exe"
stdoutLogEnabled="true"
stdoutLogFile=".\logs\stdout" />
Create your log folder.
Example: Given stdoutLogFile=".\logs\stdout"
, create logs\
in your application root directory. .\logs\
is the directory where logs will be stored, and is configurable to your preference. stdout
is a static value that'll be prepended to all file names in the log folder.
Run your request and open the log file.
Additional information on the ASP.NET Core module: ASP.NET Core Module
Don't forget to disable logging once done!
My problem was simply that IIS didn't had permission to write in the folder that the application files were located.
This is a very bad error to get.
Hope it will help somebody and not waste many hours on it.
I followed the following steps when I got the error in our environment after deployment.
Server: Windows Server 2016
IIS Version: 10.0
Step1: Check all configs are upto date
Step2: Verify Cors config. We have enabled cors and the list to allow is part of config.
I was able to solve with these two steps.
After deployment it will be mostly with the appsettings.config. Make sure the config is correct. Hope this helps.
If you deploy the app to the shared hosting, you can not run it via console. therefore I suggest doing the following steps:
Note – you will want to turn this off after you’re done troubleshooting, as it is a performance hit.
Don't get frustrated as the error doesn't give any clue. To get the error there is a simple way
This method save me several times when some critical releases gets delayed Cheers
If your Program.cs have code to get Some Folder eg : "Image Folder", etc, you need to Create the Folder Manually in your server.
to check the error in the server folder , execute command :
dotnet <yourSolutionName>.dll