Development mode error after web deploying asp net core to iss


ASP.NET is a popular programming language used for web development. It provides a framework for building dynamic web applications and services. However, sometimes developers may encounter errors when ASP.NET Core applications to IIS (Internet Information Services). One common error is the “Development mode error” that occurs after web deployment. In this article, we will explore this issue and provide possible solutions with examples.

the Development Mode Error

When deploying an ASP.NET Core application to IIS, it is important to that the application is running in the correct . By default, ASP.NET Core applications run in the “Development” environment, which provides additional debugging and error information. However, when deployed to a production server, it is recommended to run the application in the “Production” environment for better and security.

The development mode error occurs when the deployed application is still running in the “Development” environment, causing potential security risks and performance issues. This error is often displayed as a generic error message, it difficult to the root cause.

: Configuring the Environment

To resolve the development mode error, we need to configure the ASP.NET Core application to run in the correct environment. This can be done by modifying the application's configuration file, typically named “appsettings.json”.

Open the “appsettings.json” file and locate the “ASPNETCORE_ENVIRONMENT” key. By default, it should be set to “Development”. Change the value to “Production” to ensure the application runs in the correct environment.

  // Other configuration settings...

Save the changes and redeploy the application to IIS. The development mode error should no longer occur, as the application is now running in the “Production” environment.

Additional Considerations

While changing the environment configuration is the primary solution for the development mode error, there are a few additional considerations to keep in mind:

1. Environment Variables

In addition to modifying the “appsettings.json” file, you can also set the environment variable directly on the server. This can be done by accessing the server's environment variables and adding a new variable named “ASPNETCORE_ENVIRONMENT” with the value “Production”.

2. Web. File

If you are using a web.config file for your ASP.NET Core application, you can also specify the environment using the “aspNetCore” element. Add the following code within the “.webServer” section:


Make sure to replace “YourApplication.dll” with the actual name of your application's DLL file.


The development mode error in ASP.NET Core applications deployed to IIS can be resolved by configuring the application to run in the correct environment. By changing the environment configuration in the “appsettings.json” file or setting the environment variable directly on the server, the application will run in the desired environment, avoiding potential security risks and performance issues.

Remember to always test your application thoroughly after making any configuration changes to ensure it functions correctly in the production environment.

Rate this post

Leave a Reply

Your email address will not be published. Required fields are marked *

Table of Contents