Click here to Skip to main content
Click here to Skip to main content

Using Managed Code to Detect if IIS is Installed and ASP/ASP.NET is Registered

By , 30 Dec 2007
 

Introduction

My earlier article [^] on detecting what .NET Framework versions and service packs are installed using managed code generated some follow up questions related to detecting if Internet Information Services (IIS) is installed and if ASP or ASP.NET is registered.

Since this is a managed code solution, it does require that a version of the .NET Framework is already installed, so this class is not guaranteed to work as part of an installation process. If you need to do this reliably from an installation process, you need to look at doing the same work using unmanaged C++.

Background

The correct way to determine if a specific version of Internet Information Services is installed is to look in the registry for the following key:

HKLM\Software\Microsoft\InetStp\MajorVersion

This is a DWORD value that indicates the version of IIS installed, if it exists.

MajorVersion IIS Version Description
4 IIS 4 Shipped in NT Option Pack for Windows NT 4
5 IIS 5 Shipped in Windows 2000 Server and Windows XP Professional
6 IIS 6 Shipped in Windows Server 2003
7 IIS 7 Shipped in Windows Vista

For IIS 5, you can use the MinorVersion DWORD value to determine if you are running on Windows 2000 Server or Windows XP Professional. If MinorVersion is 1, then you are running on Windows XP Professional.

Detecting IIS Subcomponents

Sometimes, just knowing if IIS is installed isn't enough and you need to determine if specific subcomponents are also installed. Again, we can turn to the registry for this information. All of the subcomponent information is contained in the following registry key:

HKLM\Software\Microsoft\Microsoft\Windows\CurrentVersion\Setup\Oc Manager\Subcomponents

All of the values under this key are DWORDs, so if the value is 1 then that component is installed.

IIS Subcomponent Registry value
IIS common files iis_common
Active Server Pages (ASP) for IIS iis_asp
File Transfer Protocol (FTP) service iis_ftp
IIS Manager (Microsoft Management Console [MMC] snap-in) iis_inetmgr
Internet Data Connector iis_internetdataconnector
Network News Transfer Protocol (NNTP) service iis_nntp
Server-Side Includes iis_serversideincludes
Simple Mail Transfer Protocol (SMTP) service iis_smtp
Web Distributed Authoring and Versioning (WebDAV) publishing iis_webdav
World Wide Web (WWW) service iis_www
Remote administration (HTML) sakit_web
Internet Server Application Programming Interface (ISAPI)
for Background Intelligent Transfer Service (BITS) server extensions
BitsServerExtensionsISAPI
Background Intelligent Transfer Service (BITS)
server extensions snap-in
BitsServerExtensionsManager
FrontPage server extensions fp_extensions
Internet printing inetprint
ActiveX control and sample pages for hosting
Terminal Services client connections over the Web
TSWebClient

Detecting if ASP or ASP.NET is Registered

In order to detect if ASP is registered with IIS, you can simply look to see if the ASP component (iis_asp) is installed. However, for ASP.NET it becomes a little bit more involved since there are different versions of ASP.NET. We can also use the registry for this information, by looking at the following keys:

Framework Version Registry Key
ASP.NET v1.1 HKLM\Software\Microsoft\ASP.NET\1.1.4322.0
ASP.NET v2.0 HKLM\Software\Microsoft\ASP.NET\2.0.50727.0

If the key exists, then that version of ASP.NET is registered with IIS.

Using the Code

In order to consolidate checking all of the various registry keys and help isolate changes for future versions of the .NET Framework and IIS, the InternetInformationServicesDetection class was created. This class exposes the following public methods:

  • public static bool IsInstalled(InternetInformationServicesVersion iisVersion)
  • public static bool IsInstalled(InternetInformationServicesComponent subcomponent)
  • public static bool IsAspRegistered()
  • public static bool IsAspNetRegistered(FrameworkVersion frameworkVersion)

As you can see, these functions use the FrameworkVersion, InternetInformationServicesVersion, and InternetInformationServicesComponent enumerations. These enumerations have the following definition:

/// <summary>
/// Specifies the .NET Framework versions
/// </summary>
public enum FrameworkVersion
{
   /// <summary>
   /// .NET Framework 1.0
   /// </summary>
   Fx10,

   /// <summary>
   /// .NET Framework 1.1
   /// </summary>
   Fx11,

   /// <summary>
   /// .NET Framework 2.0
   /// </summary>
   Fx20,

   /// <summary>
   /// .NET Framework 3.0
   /// </summary>
   Fx30,

   /// <summary>
   /// .NET Framework 3.5 (Orcas)
   /// </summary>
   Fx35,
}

/// <summary>
/// Specifies the Internet Information Services (IIS) versions
/// </summary>
public enum InternetInformationServicesVersion
{
  /// <summary>
  /// Internet Information Services 4
  /// </summary>
  /// <remarks>Shipped in NT Option Pack for Windows NT 4</remarks>
  IIS4,

  /// <summary>
  /// Internet Information Services 5
  /// </summary>
  /// <remarks>Shipped in Windows 2000 Server and Windows XP Professional</remarks>
  IIS5,

  /// <summary>
  /// Internet Information Services 6
  /// </summary>
  /// <remarks>Shipped in Windows Server 2003</remarks>
  IIS6,

  /// <summary>
  /// Internet Information Services 7
  /// </summary>
  /// <remarks>Shipped in Windows Vista</remarks>
  IIS7,
}

/// <summary>
/// Specifies the Internet Information Services (IIS) versions
/// </summary>
public enum InternetInformationServicesComponent
{
  /// <summary>
  /// Internet Information Services Common Files
  /// </summary>
  Common,

  /// <summary>
  /// Active Server Pages (ASP) for Internet Information Services
  /// </summary>
  ASP,

  /// <summary>
  /// File Transfer Protocol (FTP) service
  /// </summary>
  FTP,

  /// <summary>
  /// Internet Information Services Manager
  /// </summary>
  InetMgr,

  /// <summary>
  /// Internet Data Connector
  /// </summary>
  InternetDataConnector,

  /// <summary>
  /// Network News Transfer Protocol (NNTP) service
  /// </summary>
  NNTP,

  /// <summary>
  /// Server-Side Includes
  /// </summary>
  ServerSideIncludes,

  /// <summary>
  /// Simple Mail Transfer Protocol (SMTP) service
  /// </summary>
  SMTP,

  /// <summary>
  /// Web Distributed Authoring and Versioning (WebDAV) publishing
  /// </summary>
  WebDAV,

  /// <summary>
  /// World Wide Web (WWW) service
  /// </summary>
  WWW,

  /// <summary>
  /// Remote administration (HTML)
  /// </summary>
  RemoteAdmin,

  /// <summary>
  /// Internet Server Application Programming Interface (ISAPI) for
  /// Background Intelligent Transfer Service (BITS) server extensions
  /// </summary>
  BitsISAPI,

  /// <summary>
  /// Background Intelligent Transfer Service (BITS) server extensions
  /// </summary>
  Bits,

  /// <summary>
  /// FrontPage server extensions
  /// </summary>
  FrontPageExtensions,

  /// <summary>
  /// Internet printing
  /// </summary>
  InternetPrinting,

  /// <summary>
  /// ActiveX control and sample pages for hosting Terminal Services
  /// client connections over the web
  /// </summary>
  TSWebClient,
}

A complete example in C# looks like this:

bool iis4Installed =
    InternetInformationServicesDetection.IsInstalled
        (InternetInformationServicesVersion.IIS4);

bool iis5Installed =
    InternetInformationServicesDetection.IsInstalled
        (InternetInformationServicesVersion.IIS5);

bool iis6Installed =
    InternetInformationServicesDetection.IsInstalled
        (InternetInformationServicesVersion.IIS6);

bool iis7Installed =
    InternetInformationServicesDetection.IsInstalled
        (InternetInformationServicesVersion.IIS7);


Console.WriteLine("IIS 4 installed? {0}", iis4Installed);
Console.WriteLine("IIS 5 installed? {0}", iis5Installed);
Console.WriteLine("IIS 6 installed? {0}", iis6Installed);
Console.WriteLine("IIS 7 installed? {0}", iis7Installed);

if (iis4Installed || iis5Installed || iis6Installed || iis7Installed)
{
    Console.WriteLine("ASP Registered? {0}",
        InternetInformationServicesDetection.IsAspRegistered());

    Console.WriteLine("ASP.NET 1.0 Registered? {0}",
        InternetInformationServicesDetection.IsAspNetRegistered(FrameworkVersion.Fx10));

    Console.WriteLine("ASP.NET 1.1 Registered? {0}",
        InternetInformationServicesDetection.IsAspNetRegistered(FrameworkVersion.Fx11));

    Console.WriteLine("ASP.NET 2.0 Registered? {0}",
        InternetInformationServicesDetection.IsAspNetRegistered(FrameworkVersion.Fx20));

    // These really don't exist, they are actually the .NET 2.0 version of ASP.NET.
    Console.WriteLine("ASP.NET 3.0 Registered? {0}",
        InternetInformationServicesDetection.IsAspNetRegistered(FrameworkVersion.Fx30));

    Console.WriteLine("ASP.NET 3.5 Registered? {0}",
        InternetInformationServicesDetection.IsAspNetRegistered(FrameworkVersion.Fx35));
}

Points of Interest

The public methods are simply wrappers that determine which private function should be called. These private functions, in turn, query the appropriate registry keys and process the result. However, the real work is done in the GetRegistryValue<T> function. This is a generic function that returns a boolean value indicating if the requested registry key was found and an out parameter that contains the value.

It is important to note that if the user does not have the appropriate permissions to access the registry, this function will throw an exception that will bubble up to the original caller. This was intentionally done to allow the caller the ability to take different actions based on the exception thrown.

Future Considerations

Windows XP 64-bit and Windows Vista 64-bit support. If someone wants to test this on these operating systems and let me know if it runs properly and if not what the errors are, I will correct them.

History

  • 6-April-2007
    • Original article
  • 17-August-2007
    • Updated the download to include fixes to the FrameworkVersionDetection class for the .NET Framework v3.5 Beta 2

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Scott Dorman
Software Developer (Senior)
United States United States
Member
Scott is a C# MVP and author who has been involved with computers in one way or another for as long as he can remember, but started professionally in 1993. He has worked at Fortune 500 companies and privately held start-ups focused on IT consulting where he gained experience in embedded systems design and software development to systems administration and database programming, and everything in between.
 
After spending 6 years as a systems administrator, Scott started developing eCommerce store fronts. Since 2001, he has worked on many different projects using .NET and C#. Although his primary focus right now is commercial software applications, he prefers building infrastructure components, reusable shared libraries and helping companies define, develop and automate process standards and guidelines.
 
Scott runs a software architecture-focused user group, speaks extensively, and contributes regularly to online communities such as The Code Project and StackOverflow, and is the Community Manager and Senior Editor for DotNetKicks.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
QuestionDoesn't work for mememberspyhunter99913 Apr '12 - 15:47 
IIS 7.5 installed on Windows 7 x64. the code always states that iis is not installed
Generalupdate for Fx40memberalhambra-eidos3 Mar '11 - 1:29 
any update for .net 4.0 ??
 

/// <summary>
/// .NET Framework 3.0
/// </summary>
Fx30,
 
/// <summary>
/// .NET Framework 3.5 (Orcas)
/// </summary>
Fx35,
 
...
AE

Generalupdatesmemberalhambra-eidos2 Mar '11 - 4:02 
any updates for Windows 2008, Windows 2008 R2, Windows 7 ??
 

IIS Version Operating Systems Account
 
IIS 5, IIS 5.1
Windows 2000, Windows XP
localmachine\ASPNET
 
IIS 6, IIS 7
Windows 2003, Windows Vista, Windows Server 2008
localmachine\Network Service
 
IIS 7.5
Windows 2008 R2, Windows 7
IIS AppPool\
AE

GeneralI have the ASP.NET registry key even though I do not have IIS installedmemberclaesbrandt7 Aug '08 - 5:47 
Hi Scott. Excellent article! And written in a clear and understandable language. One thing though. I can see in my registry, that I have the key HKLM\Software\Microsoft\ASP.NET\2.0.50727.0. But I don't have IIS installed. I don't think it can be used to check whether ASP.NET is registered with IIS. We could say that you first check for IIS installed and then check for the key, but what if the framework was installed before IIS? Then the key would have been written and still ASP.NET would not be registered with IIS.
GeneralRe: I have the ASP.NET registry key even though I do not have IIS installedmemberJonB14 Aug '08 - 1:52 
You are not alone, my friend!
 
I have been struggling with this one for yonks. We supply ASP.NET s/w, and half the time end-user-customer does have ASP.NET installed, then installs IIS, then wonders why our application just produces HTML-looking output page Frown | :(
 
So we need an installation-time programmatic way to at least see whether ASP.NET is registered with IIS, and do something about, even if just to advise they run aspnet_regiis -i or similar.
 
I have still not found how to do this myself, and came across your post in this thread. I doubt though that we will get an answer in a thread that is so old. Please let me know if you do discover how; I'll do same....
GeneralRe: I have the ASP.NET registry key even though I do not have IIS installedmemberclaesbrandt14 Aug '08 - 2:18 
I will. In the meantime I actually just do the aspnet_regiis -i, without asking my users. I do this from my installer and it takes a few seconds, but rather that than missing it. It works whether or not ASP.NET was already registered. Do you know if there are any drawbacks from just calling it?
GeneralRe: I have the ASP.NET registry key even though I do not have IIS installedmemberJonB14 Aug '08 - 2:50 
Oh dear, yes there are drawbacks, you should be very careful...
 
Basically, 2 areas:
 
* aspnet_regiis -i on its own changes all IIS ASP.NET apps to be registered with this version of ASP.NET. If they do have any existing 1.1 ASP.NET apps, they get reregisterd, and likely broken (situation better than used to be, ASP.NET 2 knows not to re-register later versions, but still...) I believe you are supposed to use -s ... argument to register just your app, that would be better, you should look into that.
 
* On production server, apparently this will/is likely to re-cycle all running ASP.NET apps and break existing on-line users. Recommendation never to do this while running.
 
If you search around web for aspnet_regiis -i you will find 95% of articles (including from MS) saying just do it, and 5% of articles from good people in the know who warn about above.
 
Our problem is many of our "users" are evaluators on a non-server-OS like XP, standalone. For them it might be OK. But I would not dare distribute code that did this: for the real server users it is far too dangerous. Nor would I want to do it unconditionally. At minimum maybe you should confirm with your installer that the user wants you to go ahead. I want code to check whether it (seems to) need doing; if I could do that then I would inform installer and offer to run aspnet_regiis -i but await their say-so.
GeneralRe: I have the ASP.NET registry key even though I do not have IIS installedmemberJonB17 Aug '08 - 23:01 
Well, if you/anyone is interested...
 
I'm sure that the only way to detect whether ASP.NET registered correctly with IIS is to query IIS itself (e.g. there is no registry entry or file existence instead). You might be able to do this with System.DirectoryServices in Managed Code. For myself it has to be in a very simple (non-managed) C++ program which is my "top-level" SETUP.EXE.
 
I paste below extract of my code. Tested on Win 2003/XP/Vista. Not saying it couldn't be written better (e.g. I'm lazy with "," parsing), but should give you/anyone the gist. Note that header files come with VC++.
 
#include <windows.h>
#include <crtdbg.h>
#include <tchar.h>
#include <stdio.h>
#include <CorError.h>
#include <Shlwapi.h>
#include <WinError.h>
 
				// All required for IIS detection code
#include <initguid.h>
#include <objbase.h>
#include <iads.h>
#include <adshlp.h>
#include <iiisext.h>
#include <iisext_i.c>
 
[....]
 
// ==========================================================================
// IisFxProperlyRegistered()
//
// Purpose:
//  Checks whether ASP.NET is properly "registered" with IIS
//
// ==========================================================================
BOOL IisFxProperlyRegistered()
{
    BOOL bResult = FALSE;
 
    HRESULT hr;
    IADs *pADs = NULL;
 
    try 
    {
      hr = CoInitialize(NULL);
      if (FAILED(hr))
	throw hr;
 
      hr = ADsGetObject( L"IIS://localhost/W3SVC", IID_IADs, (void **)&pADs );
      if (FAILED(hr))
	throw hr;
 
      VARIANT varWSERL;
      VariantInit( &varWSERL );
 
      // Look at list of web service extensions
      hr = pADs->Get( L"WebSvcExtRestrictionList", &varWSERL );
      if (FAILED(hr))
	throw hr;
 
      SAFEARRAY *psa;
      if (! V_ISARRAY(&varWSERL))
	throw;
      psa = V_ARRAY(&varWSERL);
 
      long uBound;
      hr = SafeArrayGetUBound(psa, 1, &uBound);
      if (FAILED(hr))
	throw hr;
 
      VARIANT varWSERLElm;
      VariantInit( &varWSERLElm );
      for (long i = 0; i <= uBound; i++)
      {
	hr = SafeArrayGetElement(psa, &i, &varWSERLElm);
	if (FAILED(hr))
	  continue;
	if (V_VT(&varWSERLElm) == VT_BSTR)
	{
	  TCHAR szStr[1000];
	  LPTSTR pNextTok;
	  LPTSTR pTokens[5];
 
	  wcstombs(szStr, V_BSTR(&varWSERLElm), 1000);
	  // it holds up to 5 tokens, separated by ','
	  // AllowDenyFlag,ExtensionPath,UIDeletableFlag,GroupID,ApplicationName
	  for (int i = 0; i < 5; i++)
	    pTokens[i] = strtok_s((i == 0) ? szStr : NULL, _T(","), &pNextTok);
	  BOOL bEnabled = (pTokens[0] != NULL && pTokens[0][0] == _T('1'));
	  BOOL bIsAspNet = (pTokens[1] != NULL && StrStrI(pTokens[1], _T("aspnet_isapi.dll")) != NULL);
 
	  if (bIsAspNet && bEnabled)
	    bResult = TRUE;
	}
	VariantClear( &varWSERLElm );
      }
    }
 
    catch( ... )
    {
    }
 
    if (pADs != NULL)
	pADs->Release();
 
    CoUninitialize();
 
    return bResult;
}
 


GeneralRe: I have the ASP.NET registry key even though I do not have IIS installedmemberclaesbrandt20 Aug '08 - 10:25 
Ohh, I am interested. This seems like COM (correct?), and I may not use that here om my project Frown | :( But I can use managed code though, so I might go that way as you suggest. Nice code Smile | :)
GeneralRe: I have the ASP.NET registry key even though I do not have IIS installed [modified]memberJonB20 Aug '08 - 21:32 
Yes, this is COM/Unmanaged, using "ADSI" calls. I (now) realise this is supposed to be a Mananged Code thread! I don't know where you are putting your test, but for me this is in my installation "bootstrapper" --- I do not assume they even have .NET Framework installed (bootstrapper will offer to install that, among others), so I certainly can't use Managed at this stage!
 
I see the original guy has written:
>>Since this is a managed code solution, it does require that a version of the .NET Framework is already
>>installed, so this class is not guaranteed to work as part of an installation process. If you need to do
>>this reliably from an installation process, you need to look at doing the same work using unmanaged C++.
 
For Managed, (I believe) you can use System.DirectoryServices. You will open "IIS://localhost/W3SVC" level, like I do. The vital point is that there you need to read the "WebSvcExtRestrictionList" Property. That will give you an array of strings for each Web Service Extension installed; you need to parse it (comma-separated) and look at the tokens for each one. It is my belief that this is the only way to correctly determine whether ASP.NET registered & enabled in IIS --- effectively, it will be what IIS itself does.
 
modified on Thursday, August 21, 2008 3:38 AM

GeneralRe: I have the ASP.NET registry key even though I do not have IIS installedmemberclaesbrandt20 Aug '08 - 21:52 
Thanks for the info, I will look into that. Btw, what installer are you using? If installing a program that depends upon .NET, wouldn't it be fine to actually use .NET in the installer? We do that here, and our installer downloads and installs the .NET framework first if it is missing.
GeneralRe: I have the ASP.NET registry key even though I do not have IIS installedmemberJonB20 Aug '08 - 22:16 
Our actual application is installed as a standard (web application) .msi, generated from VS 2005. However, I have a C++ "setup.exe" wrapper at the top-level: this checks/offers to install all sorts of other things that are needed, such as .NET Framework, MDAC, SQL Express etc., as well as our own stuff. It is at this top-level that I wish to detect the IIS/ASP.NET situation. If my function returns that it is not properly registered, I inform user of the situation and offer to run aspnet_regiis.exe -i for them, but allow them to do it themselves outside if they want (as per my earlier comment).
 
P.S.
It doesn't execute the check till after they have installed .NET Fx, if selected. Don't forget there is no point you executing this code till Fx is installed. So you could go for Managed Code at that point. For me, I can't be bothered to write a separate Mananged installation app for after I know Fx is there, I just do it in my unmanaged C++ wrapper program.
GeneralRe: I have the ASP.NET registry key even though I do not have IIS installedmvpScott Dorman21 Aug '08 - 5:05 
JonB, thanks for coming up with a solution for this. If I find some time I will convert your C++ code to C# and incorporate it into the article.
 
Scott Dorman
Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
 
[Blog][Articles][Forum Guidelines]
Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai

GeneralRe: I have the ASP.NET registry key even though I do not have IIS installedmvpScott Dorman21 Aug '08 - 5:02 
Thanks and sorry for the delay in responding. Looking through the thread for this message it sounds like JonB was able to come up with a solution that would work but is in C++. I will try to find some time to review his solution and turn it in to managed code to include in the article.
 
Scott Dorman
Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
 
[Blog][Articles][Forum Guidelines]
Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai

GeneralRe: I have the ASP.NET registry key even though I do not have IIS installedmemberJonB15 Oct '08 - 6:35 
Hi, JonB is back!
 
I thought I had this knocked on the head. Now I discover that if I (or rather, some of my end-user-installer) have:
 
* IIS 7/Vista; AND...
* ... IIS 6/Metabase "compatibility" *not* enabled/installed (as Windows feature)
 
it all blows up Cry | :(( You cannot then communicate with IIS via metabase/ADSI at all, so the principle breaks.
 
Now, I might be talking out of my hat, but my (limited) understanding is that IIS 7 has a whole new interface with no ADSI. Correct me if I'm wrong, but a .NET managed solution will use "DirectoryServices" calls which will actually use *WMI* to communicate with IIS 7(?).
And when I looked at that level of stuff originally I rejected it (as an unmanaged solution) because:
 
a) The code looked much nastier than my "ADsGetObject"-scripting-type approach; and
b) Posts were saying "you can't rely on WMI being installed/enabled, it isn't on some systems"
 
So..... I don't suppose you know what direction to point me in for this last piece of the jigsaw? (Please do say if my understanding above is incorrect.)
GeneralRe: I have the ASP.NET registry key even though I do not have IIS installedmvpScott Dorman15 Oct '08 - 8:17 
JonB,
 
You are correct. Using ADSI to talk to IIS7 will only work if IIS6 compatability is enabled. The other options are to use WMI (which IIS7 has a specific WMI provider) or the classes in the Microsoft.Web.Administration namespace (which is part of a .NET API that ships with IIS7). You can get more information about either of these here[^]. I haven't looked at any of this in detail yet so I don't know how easy/hard it will be. I'll try and find out if the Microsoft.Web.Administration assembly (or assemblies) are redistributable outside of IIS and, if so, incorporate them into the code.
 
If you manage to get a working solution, please let me know and I'll incorporate it as well, giving you appropriate credit of course.
 
Thanks,
 
Scott.
 
Scott Dorman
Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
 
[Blog][Articles][Forum Guidelines]
Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai

GeneralRe: I have the ASP.NET registry key even though I do not have IIS installedmemberJonB16 Oct '08 - 1:22 
Hi Scott Smile | :) ,
 
Yes, all too much trouble for my situation Frown | :(
Since I am in an unmanaged, very simple bootstrapper:
 
* Can't use the new (or any) .NET Microsoft.Web.Administration stuff
* Not prepared to flog myself over WMI interface for just this situation
 
FYI, I could be real lazy; had a poke around and discovered:
c:\windows\system32\inetsrv\config\applicationHost.config
file. Therein I know the line I am looking for is:
<isapiCgiRestriction>
   <add path="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" allowed="true" groupId="ASP.NET v2.0.50727" description="ASP.NET v2.0.50727" />
</isapiCgiRestriction>
 
(isapiCgiRestriction entry is new equivalent for old WebSvcExtRestrictionList). I could be real dirty and just parse actual file for this; but bootstrapper doesn't even have XML parser...
 
So finally I think I'll recognise IIS 7 and just not bother to say anything if no IIS 6 compatibility so call errors (which I would normally regard as indicating no IIS) --- at least till I see many Vista/IIS7-no-IIS6 sites. The registry entries given by someone in a post in this topic can be used to detect whether IIS7 has IIS6-compat installed.
 
Phew! Good old MS, can't believe it has to all be this difficult...
QuestionDetecting if the subcomponents are enabledmemberradikalee22 Nov '07 - 15:06 
Hi,
Your article was indeed extremely useful.
 
Moving one step further, I am trying to find a way to detect if the subcomponents that are installed are enabled for execution by IIS.
 
This is because the component may be installed but not enabled (which if by reading the value from registry will not be accurate).
 
What's your advice on going about to perform this check?
Thanks in advance for making the time to reply Smile | :)
 


 
B@mB@m
AnswerRe: Detecting if the subcomponents are enabledmvpScott Dorman21 Aug '08 - 5:08 
Sorry for the delay in responding to this. I believe the best way to determine if a component is actually enabled is to use ADSI calls. If I get some free time I will try to look in to adding this support to the article.
 
Scott Dorman
Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
 
[Blog][Articles][Forum Guidelines]
Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai

GeneralWiXmemberLyhr26 Oct '07 - 11:50 
You can create a MSI using WiX:
 
http://morten.lyhr.dk/PermaLink,guid,c91c4f51-2529-42dd-86da-201d2073aa98.aspx[^]
GeneralRe: WiXmemberScott Dorman26 Oct '07 - 14:01 
What does this have to do with the article?
 
Following your link does take you to your blog entry that shows how to do this in an MSI using WiX, but it would have been much clearer had you actually said that in your message rather than just posting the link. In either case, this article isn't about how to detect if IIS is installed through an installer, although that is one thing that it could be used for. The article presents a way to detect if IIS is installed that can be used anywhere, including other applications.
 

Scott.

—In just two days, tomorrow will be yesterday.
 
[Forum Guidelines] [Articles] [Blog]

GeneralUpdates for .NET Framework 3.5 Beta 2memberScott Dorman17 Aug '07 - 16:29 
There were a few minor updates in the FrameworkVersionDetection class due to a registry change between the January 2007 CTP and Beta 2 of the .NET Framework v3.5, so the download for this article has been updated.
 

Scott.

—In just two days, tomorrow will be yesterday.
 
[Forum Guidelines] [Articles] [Blog]

GeneralPretty Coolmemberhk1116 Aug '07 - 4:44 
That one's pretty cool, all about IIS in one article.
 
Are you from systems engineering ?
 
Regards,
h.
GeneralRe: Pretty CoolmemberScott Dorman16 Aug '07 - 5:20 
Thanks, glad you liked it.
 
Not sure what you mean by "systems engineering", since it tends to have a pretty open meaning. I am a developer now, but I did start my career as a systems administrator (mostly on Unix systems). I actually ended up writing this article based on feedback I received on my article about detecting what versions of the .NET Framework are installed.
 
-----------------------------
In just two days, tomorrow will be yesterday.
 
http://geekswithblogs.net/sdorman

QuestionIIS 6.0 Compatibility Mode on VistamemberRazi Mohiuddin16 May '07 - 20:03 
Do you know how to determine if IIS 6.0 compatibility mode is turned on in Vista?
 
Specifically I am looking to programatically determine the following:
 
1. IIS 6 Scripting Tools
2. IIS 6 WMI Compatibility
3. IIS Metabase and IIS 6 configuration compatibility.
 
TIA,
Razi

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web02 | 2.6.130523.1 | Last Updated 30 Dec 2007
Article Copyright 2007 by Scott Dorman
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid