Why I love .NET – Reason 314 – Config Files

While working the day job, I am porting over some sites from one virtual site to another.

Our clients will typically have their own external domain, which will get http redirected to a client specific sub-domain. Unfortunately, each external website has pretty much the exact same redirect page, under construction page, landing page, etc. The only difference is the redirect URL. Which, luckily in our case, can be found in the database (though, not really used).

During a deployment, we must manually turn each of the default pages to use the Under Construction page in IIS. This will prevent the redirect from occurring. However, you can see how the success of our company could lead to 4 hour long deployments, just in switching the default page.

“Why not script it?” you might be asking… That’s really the equivalent of saying “buy a nail gun if you’re nailing things” and not asking the question “is this implementation the right implementation?” In this case, it’s not.

I wrote an app that will determine the exact same thing, and do it in a fraction of the footprint, and will let us grow with little production deployment pains.

Unfortunately, we will still need to implement the updates in the production environment to make this a reality. No small task if you’re looking at doing this through the IIS manager.

But, let’s not forget that this is a server application, and therefore, should have itself a command line interface. IT DOES! It’s called appcmd, and is found in the %windows%\System32\inetsrv directory. But after doing some research, it looks like it may have some limitations when retrieving the data.

Fortunately, there is another way, and it’s found in the %windows%\System32\inetsrv\config\applicationHost.config file. I will be playing with this more in the next few hours, and so I hope to report some success.

RJ writes custom Windows and Web applications using the Microsoft .NET framework, and enjoys solving problems with code, often while listening to a techno soundcloud stream. He hopes to one day write an application that many businesses will use.

Twitter 

Comments are closed.