Reputation: 877
I'm hosting an ASP.NET C# website using IIS on Windows Server. I publish to the IIS server using Web Deploy. I have a few application settings that I configure via IIS' site-specific application settings - mostly passwords that I don't want in plain-text in my app.config within the project itself. Every time that I publish, the settings that I've created via IIS disappear. I think the publish is over writing them. I can't figure out how to get them to persist through publishes. Does anybody know how to get the IIS application settings to remain even through Web Deploy publishes?
Upvotes: 0
Views: 1928
Reputation: 479
You could also: -create a new build configuration for deployment -add a web.config transformation for this build configuration -deploy using this build configuration That's how I usually do it
Upvotes: 0
Reputation: 66
Not sure if that solves your problem, but you could try something like this:
Every config section has an optional attribute named "configSource" to point to an external file. Therefore you could break down your web.config into several files and update them accoringly:
web.config:
...
<configuration>
<appSettings/>
<connectionStrings configSource="connectionStrings.config"/>
<system.web>
...
connectionStrings.config:
<connectionStrings>
<add name="defaultConnectionString" connectionString="..." providerName="System.Data.SqlClient" />
</connectionStrings>
Then you could set the connectionString.config to not be included in the output of the project and just keep it unchanged on the server.
Upvotes: 1