error : The alias "LM/W3SVC/1/root/webapplication" already exists. Please choose a different alias.

This is the very common error that any web programmer can face when he/she tries to web share a folder.The solution is to remove the virtual directory entry from the IIS window. But what if the entry does not exist in the IIS window. This situation comes when you delete/move the folder from the c:\inetpub\wwwroot folder before deleting its virtual directory. So the solution is to remove the virtual directory entry from the IIS. Ok.... Now the million dollar question is - How to remove virtual directory entry from the IIS database?

There are 3 ways to do it.

1. Use following command-

iisweb /delete "/"

2. Recreate the folder with the same name in the c:\inetpub\wwwroot and then restart the IIS (use iisreset.exe). You will see the virtual directory with the same name in the IIS window, now remove the virtual directory.

3. Use the following command-

c\inetpub\wwwroot\cscript adsutil.vbs DELETE "W3SVC\1\root\"

4 comments:

Anonymous said...

Thank you for the great resolution. I used the second proposed solution, it worked fine.

Anonymous said...

>This situation comes when you
>delete/move the folder from the
>c:\inetpub\wwwroot folder before
>deleting its virtual directory.

Not so. This happened for me after I explicitly deleted the virtual directory first.

Anonymous said...

Thank you for this article, Im searching in the web on how to delete existing alias in IIS. It happen to me also when i try to move or delete a directory.:)

Wai said...

I used no.2.. it works.. thanks a lot..