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
, change the stdoutLogEnabled
attribute to true
.<aspNetCore processPath=".\myapp.exe"
stdoutLogEnabled="true" <!-- this'n -->
stdoutLogFile=".\logs\stdout" />
Based on the value of stdoutLogFile
, create a logs
folder in your application root directory. (Note: The stdout
part of the path refers to the log file prefix, not a folder in the directory tree.)
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.
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 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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.