Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Aspnet Core app throws developer exception on Production #8419


User avatar
0
ajayak created

I have hosted AspNetCore app as Azure App service. I have done all the things right but production app still throws developer exceptions.

Code in Configure function:

if (env.IsDevelopment())
{
    app.UseDeveloperExceptionPage();
}
else
{
    app.UseStatusCodePagesWithRedirects("~/Error?statusCode={0}");
    app.UseExceptionHandler("/Error");
}

Azure App Service Configuration: ASPNETCORE_ENVIRONMENT : Production

Also tried to delete environment variable on azure as it points to Production by default but still no luck


2 Answer(s)
  • User Avatar
    1
    alper created
    Support Team

    click to your site → All Settings → Application settings:

    Add an app setting in the "App settings" section:

    You can verify the value from the debug console: https://{your site name}.scm.azurewebsites.net/DebugConsole

    Also check your web.config. Sometimes ASPNETCORE_ENVIRONMENT is being set in web.config and it's forgotten.

    See

    • https://stackoverflow.com/a/40515803/1767482
    • https://stackoverflow.com/a/57289014/1767482
  • User Avatar
    0
    ajayak created

    Thanks @alper, it worked now :)