azure - 在 Azure Web 应用程序中显示 ASP.NET 5 错误页面

标签 azure azure-web-app-service asp.net-core asp.net-core-mvc dnx

将 ASP.NET 5 Web 应用程序部署到 Azure Web 应用程序时,我收到 500 内部服务器错误。

enter image description here

如何获取此异常的详细信息和堆栈跟踪?

我已经完成了以下操作,但没有成功:

  • 启动时使用诊断错误页面:

    app.UseErrorPage();

  • 在 Azure 门户中设置 ASPNET_ENV:

Azure Web App app settings

使用 DNX beta 6。

最佳答案

如果这对某人有帮助,我发现如果您使用 ASP.NET RC1 并且使用 Azure WebApps,并添加一个名为 Hosting:Environment 的应用程序设置,其值开发 将显示服务器 500 错误的堆栈跟踪。

enter image description here

为此,当您使用开发环境时,Startup.cs 中的配置方法需要使用开发人员异常页面。例如:

public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) {
    if (env.IsDevelopment())
    {
        app.UseDeveloperExceptionPage();
        app.UseDatabaseErrorPage();
    }

    // etc
}

关于azure - 在 Azure Web 应用程序中显示 ASP.NET 5 错误页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31992141/

相关文章:

java - 如何使用Azure认知系统?

sql-server - 从 azure sql 调用 Web 服务的最佳方法是什么?

javascript - 在 Azure Web Apps 或 Azure Functions 上远程调试 Windows Node.js 应用程序

asp.net-core - 访问 ASP.Net Core 业务逻辑中的 HTTP header

Azure 所有者角色无法创建资源组

asp.net-mvc - Microsoft Graph API 向任何请求返回 403

用于容器状态存储的 Azure Web App

c# - Azure 应用服务 Linux Web 应用 : It was not possible to find any installed . NET Core SDK

c# - 使用 IServiceCollection.AddTransient、IServiceCollection.AddSingleton 和 IServiceCollectionAddScoped 方法的实际场景有哪些?

c# - AJAX 发布数据到达 ASP.NET Core 2.1 Controller 时为空