Creating new IIS site and ERROR ( message:Failed to add duplicate collection element “yoursite”. )

If you executed a command line to create a new website in IIS8 and encountered: ERROR ( message:Failed to add duplicate collection element “yoursite”. ) this is what fixed in my case.

After executing:

C:\windows\system32\inetsrv\appcmd.exe add site /name:YourSite /id:12 /bindings:"http/*:8099:"  /physicalpath:E:\inetpub\yoursite

It errored out with the message above, and I thought that there is already a site with this name. Searing and googling and checking %windir%\system32\inetsrv\config\applicationHost.config I found nothing!

The problem was not the name it was the id!

/id:12

So if you have duplicate id the error is the same as duplicate name.
EDIT: Change the id with some unused number and you are good to go.

I hope this saves you time!

Creating new IIS site and ERROR ( message:Failed to add duplicate collection element “yoursite”. )

7 thoughts on “Creating new IIS site and ERROR ( message:Failed to add duplicate collection element “yoursite”. )

    1. Just change the ID number. I’ve picked one that is not in use. If your command now is with let say /id:12 as in my example, make it 13 and try again. You can go and see all site IDs with IIS manager – one by one, but that’s more work.
      Another option is to delete the site with the id that you are using but that is only viable if that site is obsolete, but again that depends on your case – it could be a different important site that you cannot delete.
      Let me know if this helps 🙂

      Like

  1. XKL says:

    It actually saved me an afternoon of looking for an answer, I was afraid to delete default site Id 1, but it continue to work after setting it to a different id, I moved 14 sites, and around 100 apps with it. Thanks Nik!

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s