简体   繁体   中英

How can I remove a virtual directory in the Default Web Site using appcmd.exe?

i have a virtual directory in my Default web Site , i delete this from iis list , but it is still shows in when i run

appcmd list vdir

it shows like this :

VDIR "Default Web Site/LeadsManagementServiceUAT/Services/" (physicalPath:D:\\NewExternalLMS\\Main-branchLMSSLF\\External_LMS)

i tried following command to delete it

appcmd DELETE vdir /vdir.name: "Default Web Site/LeadsManagementServiceUAT/Services/"

but it shows

    Failed to process input: The parameter 'Web' must begin with a / or - (HRESULT=8
0070057).

how do i correctly write the website name.I followed like this :

http://www.primozic.net/blog/how-can-i-remove-a-virtual-directory-in-the-default-web-site-using-appcmd-exe/

it says use like this :

appcmd delete app /app.name:"Default Web Site"/VDir

it is not working either ,.Please suggest

This is an old question which I just had to solve and I thought it would be helpful to post the correct answer since both answers here didnt really work though they are close

This was on Windows server 2008 R2 IIS 7.5 and i did use Run as administrator to open the cmd window

cd %systemroot%\system32\inetsrv

To get list of virtual directory entries

appcmd list app

This will come up with a list of apps like so

APP "Default Web Site/" (applicationPool:DefaultAppPool)
APP "Default Web Site/VirtualDir/auth" (applicationPool:DefaultAppPool)

Remove Virtual Directory called VirtualDir

appcmd delete app /app.name:"Default Web Site"/VirtualDir/auth

Its a very odd format having to enclose Default Web Site in quotes but enclosing the entire string will fail

I used this to delete four Virtual folders that had already been deleted through IIS GUI but they left orphaned directories preventing reinstallation under the same name

Hope this helps someone else

Though the poster is likely long since solved this or given up, to solve thier particular case would be

appcmd delete app /app.name:"Default Web Site"/LeadsManagementServiceUAT/Services/

Give this a shot:

appcmd DELETE app /app.name: "Default Web Site/LeadsManagementServiceUAT/Services/"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM