mercredi 15 février 2017

appSettings in Web.config and Web.Release.config

Trying to get simple <appSettings> for dev vs. prod.

My Web.config:

  <add key="hello" value="debug" />

My Web.Release.config:

  <add key="hello" value="prod" />

(both under <configuration>)

When I have it in Debug mode, and run my MVC site, I can do a simple return Content(WebConfigurationManager.AppSettings["hello"]); in my HomeController.Index and it returns dev. If I switch the mode to Release it still returns dev. I'd like to simulate prod mode without actually publishing to prod.

Aucun commentaire:

Enregistrer un commentaire