Print Page | Close Window

ASP.NET Core deployment to IIS error

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: ASP.NET Discussion
Forum Description: Discussion and chat on ASP.NET related topics.
URL: https://forums.webwiz.net/forum_posts.asp?TID=31656
Printed Date: 27 March 2026 at 11:10pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: ASP.NET Core deployment to IIS error
Posted By: pbrowne
Subject: ASP.NET Core deployment to IIS error
Date Posted: 24 January 2020 at 1:09am
I'm getting the following error on my ASP.NET Core 3.1 site:

"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. "

The site is just following the Microsoft tutorial at http://docs.microsoft.com/en-us/aspnet/core//ef-rp/intro?view=aspnetcore-3.1&tabs=visual-studio - https://docs.microsoft.com/en-us/aspnet/core/data/ef-rp/intro?view=aspnetcore-3.1&tabs=visual-studio

I have set "ASPNETCORE_ENVIRONMENT": "Production" in launchSettings.json...so not sure where else I need to set this or if that is the real problem.  Any ideas?

See http://parakeetbay.com/Students - http://parakeetbay.com/Students



Replies:
Posted By: pbrowne
Date Posted: 24 January 2020 at 2:01am
OK, I also included <EnvironmentName>Production</EnvironmentName> in theen publish profile .pubxml.  This has correctly set the environmentVariable in web.config:  However the problem persits.

<?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=".\ContosoUniversity.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess">
        <environmentVariables>
          <environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Production" />
        </environmentVariables>
      </aspNetCore>
    </system.webServer>
  </location>
</configuration>
<!--ProjectGuid: 6937ada6-9807-49f9-a251-8a1a99a61009-->


Posted By: pbrowne
Date Posted: 24 January 2020 at 7:40am
Got it sorted, it was related to a missing local express db which is not available in this hosting.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net