6

I'm new to the .NET framework developer. I just deployed my web into the web server through IIS but I'm getting some problems. I can not login and menu that need show my database table doesn't show up.

Error. An error occurred while processing your request. Request ID: 00-7ebef872d28da233400c7c5880f8e4f2-92d490fdca09490c-00

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 have already changed the environment variable in the web.config

<environmentVariables> <environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Production" /> </environmentVariables>

I also added a new system variable with

Variable Name: ASPNETCORE_ENVIRONMENT Variable Value: Production

But I'm still getting the errors. Could you help me to fix this? Thank you so much for your help.

7
  • Please change the value of ASPNETCORE_ENVIRONMENT to Development, not Production . And it will not fix the issue, it will show more error messages for you. It will help you locate the issue. Commented Feb 15, 2022 at 5:42
  • I setted it into Development before and error then I was trying to change it into Production Commented Feb 15, 2022 at 5:56
  • Pls check the eventviewer in your pc. Then update the error details in the post. And we can help you. Commented Feb 15, 2022 at 5:58
  • I know you have change to environmentVariable key, pls change to development and show us the error pic. Commented Feb 15, 2022 at 5:59
  • 2
    Thank you guys for your help. I tried to update the database in the computer server and it works. Commented Feb 16, 2022 at 6:38

2 Answers 2

6

Most probably, this error is not related to ASPNETCORE_ENVIRONMENT. If you use the ASP.NET Core template in Visual Studio, it will create an Error.cshtml Page. It is just a hard-coded message from Microsoft developers. Here is the code from ASP.NET Core Razor Pages template:

@page @model ErrorModel @{ ViewData["Title"] = "Error"; } <h1 class="text-danger">Error.</h1> <h2 class="text-danger">An error occurred while processing your request.</h2> @if (Model.ShowRequestId) { <p> <strong>Request ID:</strong> <code>@Model.RequestId</code> </p> <p>@Model.</p> } <h3>Development Mode</h3> <p> Swapping to the <strong>Development</strong> environment displays detailed information about the error that occurred. </p> <p> <strong>The Development environment shouldn't be enabled for deployed applications.</strong> It can result in displaying sensitive information from exceptions to end users. For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong> and restarting the app. </p> 

The only thing it actually shows from the error is Request ID: 00-7ebef872d28da233400c7c5880f8e4f2-92d490fdca09490c-00. The rest are not useful at all, it just suggests you swap to Development mode to see the detailed error message.

If you are publishing it to IIS make sure to edit this page to display errors properly only in the development or staging environment. NOT in a Production environment, so that public-facing clients will not see your site errors, which might show sensitive information as well. If you are displaying errors on this page, include them inside

 <environment include="Development,Staging"> message here</environment> 

block. If the project is Razor pages modify the Error.cshtml.cs file or the controller in MVC projects.

More information can be found here at the doc.

Use a staging IIS site first, so that you can see the actual errors.

Alternatively use logging (using a third-party logging provider, like Serilog ) into a text file.

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

Comments

-1

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.

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.