Show ASP.NET 5 error page in Azure web app

前端 未结 7 489
猫巷女王i
猫巷女王i 2020-12-14 17:04

I am getting a 500 Internal Server Error when deploying our ASP.NET 5 web application to an Azure Web App.

How do I get the details and stacktrace f

7条回答
  •  醉酒成梦
    2020-12-14 17:23

    In case this helps someone, I've found out that if you're using ASP.NET RC1 and you're using Azure WebApps and add an App setting called Hosting:Environment with a value of development a stack trace for server 500 errors will display.

    For this to work the Configure method in the Startup.cs needs to use the Developer Exception page when you're using the Development environment. Eg:

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

提交回复
热议问题