I tried to publish my ASP.NET Core application on Windows Server 2008 R2 but I get this error: \"An error occurred while starting the application.\"
Without any more
Althouth there many things that could go wrong and the proper way is to actually troubleshoot the error, my case was simpler:
I forgot to configure the release output path for Swagger
You can to that by following these steps:
PropertiesBuild tab Output section check the XML documentation file checkbox. This will autocomplete the path with an XML file, but you can change that to whatever you want.
I copy-paste the solution from https://mycodepad.wordpress.com/2018/08/23/publishing-asp-net-core-an-error-occurred-while-starting-the-application/