How to set ASP.NET 5 environment variables on production environment -
in visual studio 2015 set following variable in project properties: aspnet_env. if set development can use:
public void configure(iapplicationbuilder app, ihostingenvironment env) { if (env.isdevelopment()) { app.useerrorpage(); } }
isdevelopment method check aspnet_env environment variable. on development while in visual studio 2015. when publish web application iis on production server how can set value aspnet_env?
my server windows server 2012
if using iis host application, it's possible set environment variables in web.config
file this:
<aspnetcore processpath="%launcher_path%" arguments="%launcher_args%" stdoutlogenabled="false" stdoutlogfile=".\logs\stdout" forwardwindowsauthtoken="false"> <environmentvariables> <environmentvariable name="aspnetcore_environment" value="qa" /> <environmentvariable name="anothervariable" value="my value" /> </environmentvariables> </aspnetcore>
Comments
Post a Comment