Thursday, November 02, 2006
HOWTO: Change the ID of an IIS Website
Question:
Hello,
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 Description: 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
http://go.microsoft.com/fwlink/events.asp. Data: 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.
Answer:
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:
The entire metabase node under website ID 4 is copied to website node with ID 42
Since website ID 4 is running and website node with ID 42 is a website, website ID 42 also attempts to run
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
After website ID 42 finishes copying, node ID 4 is deleted
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/4CSCRIPT %SYSTEMDRIVE%\Inetpub\AdminScripts\adsutil.vbs MOVE W3SVC/4 W3SVC/42CSCRIPT %SYSTEMDRIVE%\Inetpub\AdminScripts\adsutil.vbs START_SERVER W3SVC/42//David
Posted by David Wang at 11/02/2006 12:05:00 AM