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

后端 未结 5 1204
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-31 03:24

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?

5条回答
  •  情书的邮戳
    2021-01-31 03:47

    The answer above is correct. Here's what it might look like for setting the default web site and a couple of other virtual directories. We want the default web site to be on D: with a special unique path name for the app, but two of the virtual directories belong back on C: with their own paths:

    C:\windows\system32\inetsrv\appcmd.exe set vdir "Default Web Site/" -physicalPath:"D:\MyUniquePath"
    C:\windows\system32\inetsrv\appcmd.exe set vdir "Default Web Site/OtherWebSite" -physicalPath:"C:\OtherWeb\ApplicationServer\web"
    C:\windows\system32\inetsrv\appcmd.exe set vdir "Default Web Site/ExtraPlugins" -physicalPath:"C:\OtherWeb\ApplicationServer\plugins"
    

    The syntax is easy, but determining the exact string that appcmd takes for the virtual directory can be tricky.

提交回复
热议问题