Scott Dorman

ephemeral segment

  Home  |   Contact  |   Syndication    |   Login
  570 Posts | 10 Stories | 640 Comments | 51 Trackbacks

News


Post Categories

Image Galleries



Creative Commons License


Microsoft MVP


MCP Profile


Locations of visitors to this page

Subscribers to this feed

TwitterCounter for @sdorman

View blog authority

Add to Technorati Favorites

Windows Live Alerts

AddThis Social Bookmark Button

LinkedIn profile

Community Credit profile

The Code Project

Follow me on Twitter

Get Free Shots from Snap.com

Community Credit Hall of Fame

Get Feedghost

Xobni outlook add-in for your inbox

Windows Live Translator


Support This Site

Tag Cloud


Article Categories

Archives

Post Categories

Image Galleries

Recently, someone sent me an email about my post on using managed code to detect the installed Framework versions and services packs. The posts were really just pointers to my article on The Code Project, but it did bring up an interesting topic.

The question at hand really boils down into two separate issues:

  1. How to detect if Internet Information Services (IIS) is installed.
  2. How to detect if ASP and/or ASP.NET is registered with IIS.

The best way to detect if IIS is installed is to look for the presence of the following registry key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\InetStp

If this key exists, then IIS is installed. If it doesn't exist, IIS isn't installed. It really doesn't get any simpler than that. This key also provides some additional interesting information, such as the IIS version number. The version information is kept in the following registry values, both DWORDs:

MajorVersion

  • 4: Shipped in NT Option Pack for Windows NT 4
  • 5: Shipped in Windows 2000 Server and Windows XP Professional
  • 6: Shipped in Windows Server 2003

MinorVersion

  • 1: Indicates that IIS is installed on Windows XP Professional

Ok, now that we know IIS is installed, what about detecting if the web service components of IIS are installed? There are two ways to do this. One is to look for the following key:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W3SVC

Again, if you don't have the web service components of IIS installed, this key shouldn't exist.

The other way is to look at the IIS subcompoments registry key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\Oc Manager\Subcomponents

All of the values under this key are DWORDs, so if the value is 1 then it is installed. There are a lot of values listed here, but the interesting ones (at least for this discussion) are:

  • iis_common - IIS Common Files
  • iis_asp - Active Server pages (ASP) for IIS
  • iis_www - World Wide Web (WWW) service

As you can see, this key can tell you if ASP is registered with IIS and if the web service components are installed.

Now that we know if ASP is registered, what about ASP.NET? Once again, we turn to the registry and look for the presence of the following keys:

  • .NET 1.1 - HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ASP.NET\1.1.4322.0
  • .NET 2.0 - HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ASP.NET\2.0.50727.0

I don't actually have access to a .NET 1.0 system anymore, so I don't know what the correct registry keys would be for that release. (If someone knows what they are, please let me know by a comment on this post.)

I will be updating my Code Project article (and the associate component) to also report this information sometime later this month when I get some free time.

posted on Thursday, March 01, 2007 11:06 PM

Feedback

# re: Detecting if IIS is installed and ASP/ASP.NET is registered 3/22/2007 9:10 AM Jai
'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\InetStp' will exist if IIS component was there but has been removed. So you need to check MajorVersion to be sure.


# re: Detecting if IIS is installed and ASP/ASP.NET is registered 4/27/2007 10:16 AM Matt W
Will any of this information tell me if the Web Service Extension for ASP.NET is enabled? If so, is there any information to check based on the Version of the ASP.NET extension present? What if 1.1 and 2.0 extensions are present on the same system and 1.1 is enabled and 2.0 is not? Our app. needs 2.0 so what can I check to see if this version web service extension is present and enabled, that's basically what I need to know.

# re: Detecting if IIS is installed and ASP/ASP.NET is registered 5/15/2007 12:46 PM Steve Murdock
I justed looked in an old system that had .Net 1.0 installed and then removed. The registry entry was still there:
1.0.3705.0

# re: Detecting if IIS is installed and ASP/ASP.NET is registered 12/10/2007 8:36 AM ezell johnson
this page can not be displayed is the error message
that i am getting and unable to go to any secure sites

# re: Detecting if IIS is installed and ASP/ASP.NET is registered 3/25/2009 4:15 PM howardS
This thread has been dormant for a good while but I think it is on the right path for helping me fix issues I have been having
getting SQL Server Report Sever working. SSRS thinks its server is "localhost/reportserver" but...

- "http://localhost" just gets me a 404 error.
- "ping localhost" hits 127.0.0.1 as you'd expect
- IIS is running fine (command "iis reset" stops and starts it.)
- All the registry entries you reference are in place EXCEPT iis_asp, so I have run "aspnet_regiis.exe /i" which runs apparently fine, but does not change the registry.
- regedit entries for inetStp show version Beta 5.1 of IIS - could be an issue, but SSRS install didn't flag it.

* Can you advise what might be stopping http: from finding localhost?
* Any other ideas as to what I need to do to get SSRS to find its host web site? (IIS has a "PathWWWRoot" setting of C:\Inetpub\wwwroot)

Thanks.



# re: Detecting if IIS is installed and ASP/ASP.NET is registered 3/27/2009 11:45 AM Brock Weaver
@howardS:

You're probably connecting to IIS fine. But when you request http://localhost, you're actually saying "give me the default file from C:\Inetpub\wwwroot". That file is usually index.htm or index.html or default.asp or default.aspx. If none of those files exist in C:\Inetpub\wwwroot, you'll get a 404 error. If you couldn't connect to IIS you would get a different error (500 series for server error or a different 400 series error).

Create a text file at C:\Inetpub\wwwroot\dummy.txt
Write some text in it, just copy this text if you like.
Save it
Point browser to http://localhost/dummy.txt
That should not give you a 404 error.

# re: Detecting if IIS is installed and ASP/ASP.NET is registered 7/21/2009 7:27 AM Karthika
where and how to check registry key??/

Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification: