On IIS 6.0 you will find that when you create web sites that their log files are created with seemingly random numbers. In previous versions of IIS the Instance IDs as they are called were sequentially numbered.
The first "Default Web Site" has a log file directory of W3SVC1 but any new sites you create may end up as follows (or something similar)
- W3SVC1240841244
- W3SVC1289352529
- W3SVC147076792
- W3SVC1527186048
- W3SVC1566259604
- W3SVC1710104836
I have written a script that you can use to display all the web sites and their associated Instance Ids - the output similar to the following.
Web Sites Description =============================================================== W3SVC/1 Default Web Site W3SVC/1036328378 WebSite1 W3SVC/1816184000 WebSite2 W3SVC/1867813904 WebSite3 W3SVC/568530179 WebSite4 W3SVC/719499532 WebSite5 W3SVC/669732006 WebSite6 |
See http://blog.crowe.co.nz/archive/2005/12/08/346.aspx for the script.
Something I only learned recently was that the Instance Ids can be made sequential again by editing the registry and they are not random at all.
Changing the behaviour to the same as previous IIS versions
Remember : Editing the registry is a risk you take on your own shoulders.
To do this:
- Click Start, click Run. In the Open box, type regedit, and then click OK.
- In Registry Editor, locate the following key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\InetMgr\Parameters
- Click the Parameters key. On the Edit menu, click New Dword Value.
- Type IncrementalSiteIDCreation for the name.
- Double-click the name of the new value.
- Change Value Data to 1, and then click OK.
- To enable the change, restart the IIS services.
Note: When you remotely administer another IIS server, the value of the registry key of the local server is used to determine how the site identification number is generated on the remote server.
Why was it changed?
The reason that Instance ID were changed was that if you are running a Web Farm with multiple physical IIS servers and create a web site on each server with the same description all of the web sites will have the same Instance ID.
Basically if you create a new web site in IIS 6 and then delete the web site and create it again it will be created with the same Instance ID. So if you have multiple physical web servers for a particular web application you can read the log files from the same W3SVCx where x is the instance ID.
I created a web site with a description of XYZ and it produced the Instance ID of 906768 so my log file directory ended up as W3SVC906768
I then deleted this web site and the associated Log File Directory and repeated the exercise.
It indeed did create the same Instance ID of 90768
The following table shows some descriptions and Instance IDs
| Description |
Instance ID |
Comment |
| A |
66 |
ASCII character for B not A |
| B |
67 |
ASCII character for C not B |
| AA |
6631 |
No idea why 31 appears |
| AB |
6632 |
No idea why 32 appears |
| AAA |
669696 |
No idea why 96 appears |