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:

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

My Web.Release.config:

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

(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