Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I change the physical path of web site in IIS7 with APPCMD?

Tags:

iis-7

appcmd

I need to change the physical path of a web site through the command line via the appcmd.exe tool, but I can't figure out the syntax. Can someone help?

like image 374
Paul Go Avatar asked Oct 24 '09 22:10

Paul Go


People also ask

How do I edit virtual path in IIS?

Solution 1. Open IIS Manager by Typing inetmgr on Start Menu or Run. Click On Sites on the Left navigation of IIS Manager. Right Click on Site where you want to Add Virtual Path and Choose Add Virtual Directory.

What is the physical path in IIS?

Physical path - This is the actual path the file is located by IIS. Virtual path - This is the logical path to access the file which is pointed to from outside of the IIS application folder. Let's display this image from Hard-drive 'E' using a virtual directory in IIS Default web site.

Where is AppCmd exe located?

AppCmd.exe is located in the %systemroot%\system32\inetsrv\ directory. Because it is not part of the PATH automatically, you need to use the full path to the executable when executing commands like in %systemroot%\system32\inetsrv\AppCmd.exe list sites .


1 Answers

This is how you should do:

C:\Windows\System32\inetsrv>appcmd set vdir "MySite/" -physicalPath:"C:\inetpub\temp"

Note: "MySite/" is a name of your virtual directory so if your virtual directory is under default web site you're likely have to set "Default Web Site/MySite/"


As for figuring out how to do other appcmd commands just type: appcmd set vdir /?

and you'll get all the info on what you can do to set your virtual directory.

Even more specifically, if you want to know what settings you can change for the specific virtual directory type:appcmd set vdir "MySite/" /?

These examples are just for virtual directory by they apply to other appcmd commands

Hope this helps

like image 191
Enes Avatar answered Nov 13 '22 18:11

Enes