How do I debug an ASPNET Core MVC Application Deployed in Azure

[亡魂溺海] 提交于 2019-12-07 03:29:10

问题


I've created a simple ASPNET Core 1.0 MVC app, which I am trying to deploy to Azure using Visual Studio. I am able to run this app locally on my machine using IIS Express, and navigate to my default route and display the page. However, in Azure I always get a 500 error every time, and at this point I am at a loss for how to get additional information.

I've enabled detailed request logging in my Azure app, but it doesn't really seem to tell me much.

ModuleName="AspNetCoreModule", Notification="EXECUTE_REQUEST_HANDLER", HttpStatus="500", HttpReason="Internal Server Error", HttpSubStatus="0", ErrorCode="The operation completed successfully.
 (0x0)", ConfigExceptionInfo="" 

I've stripped down my Startup configuration to the bare essentials

public void ConfigureServices(IServiceCollection services)
{
    services.AddMvc();
}

public void Configure(IApplicationBuilder app, ILoggerFactory loggingFactory)
{

    loggingFactory.AddConsole();
    loggingFactory.AddDebug();

    app.UseMvc(routes => {
        routes.MapRoute(
            name: "default",
            template: "{controller=Home}/{action=Index}/{id?}"
        );
    });

}

Something must be blowing up in the MVC pipeline but I have no idea how to add more visibility. What can I do to get more information?

And in case it matters, this is my Program.cs

var host = new WebHostBuilder()
    .UseKestrel()
    .UseContentRoot(Directory.GetCurrentDirectory())
    .UseIISIntegration()
    .UseStartup<Startup>()
    .Build();

host.Run();

回答1:


Try setting ASPNETCORE_ENVIRONMENT to Development to display full exception message on the error page.

Remember to turn it off when finished, otherwise you will leak error information.



来源:https://stackoverflow.com/questions/38749168/how-do-i-debug-an-aspnet-core-mvc-application-deployed-in-azure

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!