如何调试在Azure中部署的ASPNET Core MVC应用程序 [英] How do I debug an ASPNET Core MVC Application Deployed in Azure
问题描述
我已经创建了一个简单的ASPNET Core 1.0 MVC应用程序,我正在尝试使用Visual Studio将其部署到Azure.我可以使用IIS Express在本地计算机上运行此应用程序,并导航到默认路由并显示页面.但是,在Azure中,每次每次都会出现500错误,并且在这一点上,我对如何获取其他信息一无所知.
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.
我已经在我的Azure应用中启用了详细的请求日志记录,但是似乎并不能告诉我很多.
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=""
我已经将Startup配置简化为基本要求
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?}"
);
});
}
MVC管道中肯定有什么异常,但是我不知道如何增加可见性.我该怎么做才能获得更多信息?
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?
如果有关系的话,这就是我的Program.cs
And in case it matters, this is my Program.cs
var host = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.Build();
host.Run();
推荐答案
尝试将ASPNETCORE_ENVIRONMENT
设置为Development
,以在错误页面上显示完整的异常消息.
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.
这篇关于如何调试在Azure中部署的ASPNET Core MVC应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!