Error after deploying asp.net core application for azure

After deploying my main asp.net application in azure for the first time and launching it, I received the following error:

Error. An error occurred while processing your request. development The Swapping to Development mode will display more information about the error that occurred.

The development environment should not be included in the deployed application, as this may cause exceptions to be displayed to end users. For local debugging, the development environment can be enabled by setting the ASPNETCORE_ENVIRONMENT environment variable for development and restarting the application.

Note that I tried debug and release mode when publishing to visual studio, and I made sure that I chose the default migration and also have a connection string. If possible, can you tell me how to enable development mode as shown, or explain the error further? thank you

Edit: according to the suggestion I received, I found the following in the cloud explorer log:

Msvsmon could not start the server with the name "127.0.0.1:50867". The following error occurred: an instance of the remote debugger is already running on this computer, or another process is already connected to the specified TCP / IP port.

+7
source share
3 answers

To be clear - still what appears in ASP.NET Core 2.0 - and, as @Techy said, in Azure. Go to Azure, click your web application → "Application Settings" → go to the "Application Settings" section and add "ASPNETCORE_ENVIRONMENT" and "Development"

. Azure portal

+13
source

Thanks for your comments. I managed to find detailed information about the error by adding the following key in the application settings on the Azure portal: ASPNETCORE_ENVIRONMENT with the value:

I created a new question regarding the error itself: InvalidOperationException: Could not find & # 39; UserSecretsIdAttribute & # 39; on assembly

thanks

+4
source

This is a security measure used in production mode so that any user does not receive confidential information about exceptions from our application.

You can change ASPNETCORE_ENVIRONMENT from Production to Development.

Another option is to change the Configure () method code in Startup.cs. It is this method that does the check:

public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Error"); } ... } 

This is not recommended, but you can eliminate this condition:

 public void Configure(IApplicationBuilder app, IHostingEnvironment env) { app.UseDeveloperExceptionPage(); ... } 
0
source

Source: https://habr.com/ru/post/1260015/


All Articles