Tuesday, April 9, 2019

Debug ASP.Net project deployed to MS Azure from Visual Studio

The below steps can be used to debug asp.net core project deployed to MS Azure app service from Visual Studio 2017.
1. From Visual Studio 2017, publish the asp.net core app to Azure, setting the Configuration to "Debug"
2. In MS Azure portal, app service configuration, select Settings->Configuration, and set Remote Debugging to On, and select Remote Visual Studio version to 2017
3. From Visual Studio, select menu of View->Cloud Explorer, find the MS Azure App service item which has the project deployed to, and then right click it, and select "Attach Debugger"



In addition, for debug purpose, you may want to run asp.net application deployed on Azure in development mode, instead of production mode, so that the error page can contain more information about the error.

To do so, in Azure portal, app service's Settings/Configuration section, add a new setting as below:
ASPNETCORE_ENVIRONMENT     Development

1 comment: