Search

Apr 4, 2012

Changing Physical Path of multiple Applications in IIS 7

Hello All,

Usually, we need functionality where we have more then one set of application configured in our machine, like QA environment and DEV environment. We don’t have way to keep two directory pointing to same location in single web site.

We can use backup feature for IIS 7 which helps to take backup as well as change directories of multiple applications at same time. First we are going to do backup IIS7

Go to your inetsvr directory for your system’s system32 directory from command prompt. Make sure you are using Administrator account, if not then open command prompt with “run as administrator”

image 

Write following command in command prompt

appcmd add backup NAME_OF_BACKUP

image

I have created backup with name IISBackup, So we created backup of IIS including application pool, application, virtual directory etc. We will now change the physical path of more then one application and then restore backup back to IIS

Open backup folder in explorer.

image

Open that folder and edit applicationHost.config into notepad

image

In sites tag you can see your application with all details. Update physicalPath with your new path and save the file

image

Once you are done with this, go back to command prompt to restore our updated IIS settings, write following command, it will take few secs to set your new configurations.

appcmd restore backup NAME_OF_BACKUP

image

You are done!

So, we see how to backup and restore IIS, and how to change physical path of more then one applications.

2 comments:

Unknown said...

Great post!
Once again you have surprised me with your knowledge. I'm sure to use this in all of my future deployments!

Stuart Ben said...

I’m so lucky today that I was able to read your post which gives me a lot of ideas that I’ve been looking for. With this, I can use it to my site…I hope to read more of your future post. Thanks a lot