Thursday, November 02, 2006

HOWTO: Change the ID of an IIS Website



When I install Sharepoint Services, it creates a web site with an identifier. (Ex. ID 4).

I need to change that ID for another one. So I use this command :

cscript adsutil.vbs move w3svc/4 w3svc/4243.

It does the trick...

But, when I look in IIS I see that the site is stopped and I have this error in the event logs:

Event Type:           Error 
Event Source: W3SVC
Event Category: None
Event ID: 1007
Date: 2006-10-25
Time: 13:19:46
User: N/A
Computer: U1U206V

Cannot register the URL prefix 'http://*:24051/' for site '42'. The
necessary network binding may already be in use. The site has been
deactivated. The data field contains the error number.

For more information, see Help and Support Center at

0000: b7 00 07 80 ·..€

If I start the site manually, the site starts fine with no errors.

I just want to know if there's a way to not receive this error message when I change the ID of my site.

Can someone confirm that?

Or is there another way to do it to prevent errors?

Thx in advance for your help.


The reason you get that error event when you MOVE a running website is due to how ADSUTIL.VBS MOVE works. You can treat the MOVE operation as a non-atomic COPY-then-DELETE... because it is designed to move arbitrary metabase nodes (for example, one vdir to another vdir in a different tree hierarchy).

Thus, when you use it to move from website ID 4 to website ID 42, what happens is this:

  1. The entire metabase node under website ID 4 is copied to website node with ID 42
  2. Since website ID 4 is running and website node with ID 42 is a website, website ID 42 also attempts to run
  3. However, since both website nodes are duplicates and have the exact same bindings, the new website ID 42 cannot start due to duplicate bindings and trigger the error event
  4. After website ID 42 finishes copying, node ID 4 is deleted
  5. But website ID 42 has already failed to start; there is no state change here

The key is to STOP the source website ID prior to executing the MOVE. In that case, there will be no duplicate bindings simultaneously running during the COPY-the-DELETE, and one will not see the error event.

CSCRIPT %SYSTEMDRIVE%\Inetpub\AdminScripts\adsutil.vbs STOP_SERVER W3SVC/4
CSCRIPT %SYSTEMDRIVE%\Inetpub\AdminScripts\adsutil.vbs MOVE W3SVC/4 W3SVC/42
CSCRIPT %SYSTEMDRIVE%\Inetpub\AdminScripts\adsutil.vbs START_SERVER W3SVC/42



jim said...

Can you use names for the ID's instead of the numbers? If so can you epxlain? I want to be able to find the directory to grep a log quicker instead of an id number for each web site (since I run several)



David Wang said...

IIS uses an ID number to uniquely identify websites. Each website has a "Friendly name" associated with it, and this "Friendly name" is what the UI displays.

You can certain use the "Friendly name" to search and map back to an ID number, but internally all operations have to be made with the ID number.

I am not certain what you mean by "I want to be able to find the directory to grep a log quicker instead of an id number for each website".

The IIS log file uses the website ID, which is the easiest way to map back to a directory. You can use the ID to map back to a "Friendly name" if you want.


Mike Hunsaker said...

This also helped me resolve an issue with Exchange 2007 and Outlook Anywhere. The cmdlet Enable-OutlookAnywhere was failing because I had no website at /W3SVC/1/ROOT.

I used the commands here to move my website and was able to enable outlook anywhere.

I did have to go into ADSIedit and update the MetaBasePath for my existing OWA sites to adjust for the moved website.

Anonymous said...

Cheers for the help.

Adi said...

Oes Tsetnoc one of the ways in which we can learn seo besides Mengembalikan Jati Diri Bangsa. By participating in the Oes Tsetnoc or Mengembalikan Jati Diri Bangsa we can improve our seo skills. To find more information about Oest Tsetnoc please visit my Oes Tsetnoc pages. And to find more information about Mengembalikan Jati Diri Bangsa please visit my Mengembalikan Jati Diri Bangsa pages. Thank you So much.
Oes Tsetnoc | Semangat Mengembalikan Jati Diri Bangsa

longge said...

lv features Monogram canvas with natural cowhide trim. The classic louis vuitton and quatrefoil signature design always can attract appreciations from someone special hidden in the crowd. The shiny brass hardware and the modern, feminine shape make Louis vuitton bags exude a more luxurious look. Besides the pleasing appearance, louis vuitton handbags is multi-functional.

shoppingugg said...

Finding a Coach Wallets with an actual unique serial number is next to impossible. Coach Gallery hasn't used a true serial number for about 10 years. Sure, the older bags had true serial numbers, but not anymore. The myths, urban legends or simple un-truths surrounding Coach Legacy have caused many a girl to go into a panicked frenzy of sorts after receiving Coach Madison that had a patch with no numbers or worse yet, no patch at all!

Bentley GT is part of the Chronomat B01 series. There are several variations of the Superocean including custom build editions. Models include the basic Cockpit, Chrono Cockpit, and the Cockpit Lady. The basic model has mechanical self winding, features Navitimer Watches movement, a 42 hour power reserve, and is water resistant to 30 meters.

vishal said...

Easy Earning money in online never been this easy and transparent. You would find great tips on how to make that dream amount every Day.Sitting in the home earn around $100 perday. So go ahead and click here for more details and open floodgates to your online income. All the best.

Sildenafil Citrate said...

I was wondering how to change the ID of an IIS website yesterday and honestly I had no freaking idea, thanks to you now I know better thanks for the information!

longge said...

However, ugg boots which owns a array of acclaimed designers, not abandoned delights women by contemporary styles, but aswell by absolute abundance and practicality.Sheepskin ugg is absolutely crafted from wool. Many times, uggs are befuddled abroad because they get adulterated or channelled afterwards getting beat for one season, instead of acceptable out of date. There are lots of styles in the accumulating of affidavit ugg sundance , accoutrement tall, abbreviate and abate versions. Due to adaptable sheepskin, these ugg sundance boots do not get channelled or torn even admitting you bend and extend them times.

cialis prescription said...

hey buddy,this is one of the best posts that I�ve ever seen; you may include some more ideas in the same theme. I�m still waiting for some interesting thoughts from your side in your next post.

Cafe24 Extension said...

I have multiple sites running in IIS7 with host headers. I would like be able to change the default website or site ID 1 to another site.
I deleted the site with Site ID = 1 and then modified the side ID for another website in the applicationHost.config to be Side ID = 1.

toko herbal said...

Glad to visit your site. An awesome blog. Nice Information It's really very informative that I wanted ever, thanks for this. Jual Peninggi Badan Alami Bali Ratih Obat Jerawat Obat Asam Urat Alami Kapsul Mengkudu Obat Pelangsing Badan HerbalMadu Hitam Pahit Masker Wajah Alami