I'd like my Asp.Net Core app to still run in the Development environment when published to Widnows server.The app is is being tested on our website and I'd like to see the details of exceptions. I've read bunch of articles on Stackoverflow,but didn't understand how to get it done.The articles talk about setting different environments,which sound pretty complicated and I don't need them.I'd appreciate it if someone could help me set the Development in web.config or somewhere else.
Asked
Active
Viewed 74 times
1
-
The way the environment works in ASP.NET Core is: You need to set an environment variable in your system (your server, local box whatever it is): ASPNETCORE_ENVIRONMENT. Might look complicated but it really isn't. Now, can you explain where you are deploying this? Is it to IIS Server? Azure? – jpgrassi Apr 20 '19 at 07:44
-
If you mean IIS then look at https://stackoverflow.com/questions/31049152/publish-to-iis-setting-environment-variable – svoychik Apr 20 '19 at 07:45
-
Thanks for answering,but I don't have access to the server settings.My Asp.Net Core app is being deployed in a remote server,and I can deploy the files using the File Manager,but I don't find Configuration Editor to make changes as described in the link.I thought there's a place in code to set the environment,isn't there? – Meisam Dehghan Apr 20 '19 at 09:34
1 Answers
2
In your Program.cs call UseEnvironment("Development")
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseEnvironment("Development")
.UseStartup<Startup>();

Artur
- 4,595
- 25
- 38