Geeks With Blogs

News



Microsoft Store

Support This Site


AddThis Social Bookmark Button

Locations of visitors to this page

Subscribers to this feed

TwitterCounter for @sdorman

Creative Commons License


Scott Dorman Microsoft MVP, Software Architect, Developer, Author

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 1, 2007 11:06 PM .NET (General) , .NET (C#) | Back to top


Comments on this post: Detecting if IIS is installed and ASP/ASP.NET is registered

# re: Detecting if IIS is installed and ASP/ASP.NET is registered
Requesting Gravatar...
'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.
Left by Jai on Mar 22, 2007 9:10 AM

# re: Detecting if IIS is installed and ASP/ASP.NET is registered
Requesting Gravatar...
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.
Left by Matt W on Apr 27, 2007 10:16 AM

# re: Detecting if IIS is installed and ASP/ASP.NET is registered
Requesting Gravatar...
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
Left by Steve Murdock on May 15, 2007 12:46 PM

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

# re: Detecting if IIS is installed and ASP/ASP.NET is registered
Requesting Gravatar...
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.

Left by howardS on Mar 25, 2009 4:15 PM

# re: Detecting if IIS is installed and ASP/ASP.NET is registered
Requesting Gravatar...
@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.
Left by Brock Weaver on Mar 27, 2009 11:45 AM

# re: Detecting if IIS is installed and ASP/ASP.NET is registered
Requesting Gravatar...
where and how to check registry key??/
Left by Karthika on Jul 21, 2009 7:27 AM

# re: Detecting if IIS is installed and ASP/ASP.NET is registered
Requesting Gravatar...
Start->Run... then type in regedit
Left by Jez on May 27, 2010 3:57 AM

# re: Detecting if IIS is installed and ASP/ASP.NET is registered
Requesting Gravatar...
Good analysis, good reporting. We need to know this information.
web engineering
Left by STEVE on Oct 21, 2010 3:38 AM

# re: Detecting if IIS is installed and ASP/ASP.NET is registered 3/27/2009 11:45 AM Brock Weaver
Requesting Gravatar...
Thanks a lot 4 u brock! i was searching the same! really very happy!
Left by Malathi on Dec 16, 2011 5:11 AM

# re: Detecting if IIS is running and ASP.NET is registered
Requesting Gravatar...
hi....

how to chech wether iis of server is working or not in asp.net...?
Left by Ranjithkumar on Dec 19, 2011 8:30 AM

# re: Detecting if IIS is installed and ASP/ASP.NET is registered
Requesting Gravatar...
GGK WORK
Left by streeteam on May 28, 2012 9:11 AM

# re: Detecting if IIS is installed and ASP/ASP.NET is registered
Requesting Gravatar...
i need more way
Left by maha on Sep 26, 2013 11:46 AM

Your comment:
 (will show your gravatar)


Copyright © Scott Dorman | Powered by: GeeksWithBlogs.net | Join free