I am trying to work on a large website, and I have no idea how this is supposed to work. I have database, connection string and email settings, as well as settings to write files to the hard drive all stored in the web.config file.
However, obviously, these settings are different on the test server then they are on the production server.
It's getting very annoying, and very confusing to have to go into web.config and edit the connection string, file path, ASPSession type, email settings, debug settings, custom error settings, and other settings every single time I want to test on setting
on IIS, or on the Beta server or on the production server.
I have no idea how I'm supposed to keep all of there straight.... There has to be a better way to manage this, or some way that Visual Studio can manage this for me, because I just can't work like this.
I upload the wrong settings to the wrong servers and all the websites go down, and tracking down the errors is just too much for someone to deal with.
A purely manual method is: create a different web.config for each case, with a different name. Copy the appropriate one to web.config for local testing, or for publishing to the server, as needed.
web.config.local, web.config.remote, each copied as needed to web.config. Copy, don't rename: Leave the originals alone, so you don't risk overwriting one with the other.
Marked as answer by Kensino on Dec 08, 2012 11:26 PM
Ok, I've followed that article and created two configurations, Release and Debug, and I still don't have an option to "Add Transform" when I right-click on web.config. I can't find anyone else with this problem online, so I have no idea why it would be doing
that.
Kensino
Member
70 Points
185 Posts
Too Much Work
Dec 08, 2012 08:53 PM|LINK
I am trying to work on a large website, and I have no idea how this is supposed to work. I have database, connection string and email settings, as well as settings to write files to the hard drive all stored in the web.config file.
However, obviously, these settings are different on the test server then they are on the production server.
It's getting very annoying, and very confusing to have to go into web.config and edit the connection string, file path, ASPSession type, email settings, debug settings, custom error settings, and other settings every single time I want to test on setting on IIS, or on the Beta server or on the production server.
I have no idea how I'm supposed to keep all of there straight.... There has to be a better way to manage this, or some way that Visual Studio can manage this for me, because I just can't work like this.
I upload the wrong settings to the wrong servers and all the websites go down, and tracking down the errors is just too much for someone to deal with.
ryanbesko
Contributor
3561 Points
619 Posts
Re: Too Much Work
Dec 08, 2012 09:28 PM|LINK
Check out web.config transformations:
http://msdn.microsoft.com/en-us/library/dd465318(v=VS.100).aspx
KathyW
Participant
1638 Points
299 Posts
Re: Too Much Work
Dec 08, 2012 10:27 PM|LINK
A purely manual method is: create a different web.config for each case, with a different name. Copy the appropriate one to web.config for local testing, or for publishing to the server, as needed.
web.config.local, web.config.remote, each copied as needed to web.config. Copy, don't rename: Leave the originals alone, so you don't risk overwriting one with the other.
Kensino
Member
70 Points
185 Posts
Re: Too Much Work
Dec 08, 2012 11:27 PM|LINK
Thanks for the help. I'll try this, and if I still have more problems, I'll post back later.
Kensino
Member
70 Points
185 Posts
Re: Too Much Work
Dec 09, 2012 01:16 AM|LINK
Ok, I've followed that article and created two configurations, Release and Debug, and I still don't have an option to "Add Transform" when I right-click on web.config. I can't find anyone else with this problem online, so I have no idea why it would be doing that.
Kensino
Member
70 Points
185 Posts
Re: Too Much Work
Dec 10, 2012 04:38 PM|LINK
I just went the other route and created two files manually, then I copy and paste the entire file before I upload to the production site.
It's easier then trying to figure out why these other things aren't working correctly.
Thanks.