Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

ASP.NET Core with Entity Framework Core – ASPNETCORE_ENVIRONMENT

This is another one, Figure 1, that just kind of happened because I dropped my database.  Once I re-created the database and my ASP.NET Core application could access it, all was back to normal.

Figure 1, ASPNETCORE_ENVIRONMENT environment variable to Development, and restarting the application.

Error.

An error occurred while processing your request.

Development Mode

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

Development environment should not be enabled in deployed applications, as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the ASPNETCORE_ENVIRONMENT environment variable to Development, and restarting the application.

Most likely because I had the environment variable ASPNETCORE_ENVIRONMENT set to Development as seen in Figure 2.

Figure 2, ASPNETCORE_ENVIRONMENT environment variable to Development, and restarting the application.

And also there is some code in the default public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) method in the Startup.cs file which checks for this.

if (env.IsDevelopment())
{
   app.UseDeveloperExceptionPage();
   app.UseBrowserLink();
}
else
{
   app.UseExceptionHandler("/Home/Error");
}

Learn more about ASPNETCORE_ENVIRONMENT here.

See my other ASP.NET Core articles:

  • How to deploy an ASP.NET Core 1.1 application to an Azure App Services Web App using Visual Studio 2017
  • ASP.NET Core (-4077,–4047,–4089, 4095)
  • How to deploy a .NET Core console application to Azure, WebJob
  • .NET Core application, where is my EXE, how to publish
  • Create and deploy an ASP.NET Core Web API to Azure Windows

Share the post

ASP.NET Core with Entity Framework Core – ASPNETCORE_ENVIRONMENT

×

Subscribe to Msdn Blogs | Get The Latest Information, Insights, Announcements, And News From Microsoft Experts And Developers In The Msdn Blogs.

Get updates delivered right to your inbox!

Thank you for your subscription

×