1

Development Mode
Swapping to Development environment will display more detailed information about the error that occurred.

The Development environment shouldn't be enabled for deployed applications. It can result in displaying sensitive information from exceptions to end users. For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development and restarting the app.

I try publish simple application built with .NET Core MVC. I've tried replacing launchSetting.json. It's not working.

enter image description here

5
  • Have you tried adding the environment variable given in the error message to your App Service to see what the problem is? Commented Feb 8, 2022 at 15:54
  • Welcome to Stack Overflow. Please take the tour, read what's on-topic, and How to Ask, where there is a bullet saying, "DO NOT post images of code, data, error messages, etc. - copy or type the text into the question." Commented Feb 8, 2022 at 15:55
  • Are you able to build/access the app locally ? Commented Feb 8, 2022 at 16:19
  • Or Go to Azure, click on your Web App –> "Applications Settings" –> go down to the “App Settings” section and check the key “ASPNETCORE_ENVIRONMENT” and value “Development” Commented Feb 8, 2022 at 16:53
  • In Startup.cs, in configure method add - app.UseDeveloperExceptionPage(); Commented Feb 8, 2022 at 17:02

1 Answer 1

1
  • You can change ASPNETCORE_ENVIRONMENT from "Production" to "Development".
  • Add ASPNETCORE_ENVIRONMENT with value: Development in Azure Portal. Go to AzurePortal => your Web App =>Configuration => "Applications Settings" => add the “ASPNETCORE_ENVIRONMENT” and “Development”
  • In Startup.cs, change the code for the Configure () method .
public void Configure(IApplicationBuilder app, IHostingEnvironment env) { app.UseDeveloperExceptionPage(); ... } 
  • Modify your web.config file with the below. If you dont have a web.config , add one.
<aspNetCore processPath="dotnet" arguments=".\projectName.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout"> <environmentVariables> <environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" /> </environmentVariables> </aspNetCore> 

OR The web.config in its entirety should resemble the below (update "projectName.dll" for your project appropriately):

<?xml version="1.0" encoding="utf-8"?> <configuration> <location path="." inheritInChildApplications="false"> <system.webServer> <handlers> <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" /> </handlers> <aspNetCore processPath="dotnet" arguments=".\projectName.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="InProcess" > <environmentVariables> <environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" /> </environmentVariables> </aspNetCore> </system.webServer> </location> </configuration> 

Please refer these similar issue articles A1 , A2 , A3 for more information.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.