Using Visual Studio 2012 Web Publish For Staging On The Internet

 

Let’s say you have a production code like http://siliconvalley-codecamp.com and you want to have a test site on the internet that will not be seen by anyone unless they login (or maybe even login as an admin).  Using web.config (with Visual Studio 2012), transformations makes that very straight forward.  I know because I just did that.  I created a test site (say: http://test.siliconvalley-codecamp.com) and set up my publish to replace my normal anonymous authentication (allowing anonymous users) to one that denies anonymous users.  Just as an aside, the reason I did this was I notice that google was indexing some of those pages even though my robots.txt file says to deny access to all robots.  Apparently some crawlers don’t respect that signal.

For a little background, I did publish some basics about doing transforms here:

http://peterkellner.net/2013/03/31/vs2012-web-deploy-using-tranforms-for-connection-string-in-production/

So, here is what I have in my web.config file that is part of my normal project source control.

image

And, here is my transform file (Web.Test.config)

image

And, just to show the result, this is what end up on my test server:

image

And Finally, just for some extra bonus stuff here at the end, here is what my tranformation looks like that simply removes the debug option when I publish to production.

image

About Peter Kellner

Peter is a software professional specializing in mobile and web technologies. He has also been a Microsoft MVP for the past 7 years. To read more about Peter Kellner and his experience click here. For information about how Peter Kellner might be able to help you with your project click here.

Follow me:


Trackbacks

  1. […] Using Visual Studio 2012 Web Publish For Staging On The Internet – Peter Kellner […]

Follow

Get every new post delivered to your Inbox

Join other followers: