如何调试在Azure中部署的ASPNET核心MVC应用程序

时间:2021-09-23 21:15:29

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.

我创建了一个简单的ASPNET Core 1.0 MVC应用程序,我试图使用Visual Studio部署到Azure。我可以使用IIS Express在我的机器上本地运行此应用程序,并导航到我的默认路由并显示页面。但是,在Azure中,我每次都会收到500错误,此时我对如何获取其他信息感到茫然。

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

我在我的Azure应用程序中启用了详细的请求记录,但它似乎并没有告诉我太多。

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

我已经将我的Startup配置剥离到了必需品

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?

在MVC管道中必须有些东西,但我不知道如何增加更多可见性。我该怎么做才能获得更多信息?

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

如果重要,这是我的Program.cs

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

host.Run();

1 个解决方案

#1


12  

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

尝试将ASPNETCORE_ENVIRONMENT设置为Development以在错误页面上显示完整的异常消息。

如何调试在Azure中部署的ASPNET核心MVC应用程序

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

记得在完成后将其关闭,否则您将泄漏错误信息。

#1


12  

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

尝试将ASPNETCORE_ENVIRONMENT设置为Development以在错误页面上显示完整的异常消息。

如何调试在Azure中部署的ASPNET核心MVC应用程序

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

记得在完成后将其关闭,否则您将泄漏错误信息。