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

The Curious Case of Internet Information Services

By , 20 Sep 2010
 

Introduction

Any developer would agree that Microsoft products, especially the IIS, often throw up unusual situations. This mainly happens after a major product upgrade. We get so used to the old one that we want to hang on to that forever and refuse to adjust to the settings of the new version. The objective of this paper is to describe the idiosyncrasies of IIS (mainly 7.5) that I have faced under different situations. I have documented some of the problems and their solutions.

The intention is to get a knowledge base going so that others could benefit from these tips and save some valuable time brainstorming on those completely confusing error messages that IIS throws up!!

Note – For each situations mentioned below, I have also mentioned the version of IIS and the Operating System on which they were encountered. The solutions would also be specific to that Operating System unless otherwise mentioned. You need to adjust accordingly if you are using some other OS.

Problem #1 - Problem hosting WCF services in IIS (IIS 7.5, OS – Windows 7)

If you are hosting WCF services .svc file 1st time on IIS 7.5, you are most likely to get the following error –

404 – Not Found - The page you are requesting cannot be served because of the extension of the configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map.

This is because the HTTP Handler configured by default for any virtual directory will not have the mapping for the .svc extension. This is what you have to do to get things working -

  1. Go to command prompt
  2. Navigate to the following folder using DOS command –
    C:\Windows\Microsoft.Net\Framework\v3.0\Windows Communication Foundation
  3. Type
    ServiceModelReg –i

You should be all set. Now if you go to your directory and check Handler Mappings you should see .svc mapped to svc-ISAPI-2.0. Refer screenshot below.

ServiceModelReg.jpg

Problem #2 - Cannot see Windows authentication in IIS (IIS 7.5, OS – Windows 7)

By default IIS 7.0 has only the following authentication modes:

  • Anonymous (Enabled by default)
  • Impersonation (Disabled by default)
  • Forms (Disabled by default)

What happened to the good old Windows Authentication? Well, to make things easy for us (pun intended), Microsoft decided not to enable them by default. If you need to see them in your IIS Authentication page then you need to do the following things –

  1. Go to - Start -->Control Panel -> Programs and Features
  2. Click -> Turn Windows Features On / OFF on the left hand pane
  3. Find Internet Information Services and expand
  4. Expand World Wide Web Services
  5. Expand Security
  6. Select the Windows Authentications from the list and click OK.

Refer screenshots below.

WindowsAuth.jpg

WindowsFeatures.jpg

image004.jpg

Problem #3 - Error - Login failed for user 'IIS APPPOOL\Classic .NET

I encountered this when my Web service was trying to access a database with Windows Credentials. The Host Server has SQL Server 2008 and the HTTP request was routed through IIS 7.5.

Solution to this problem lies in changing the Identity property of the process model of the Classic .NET Application pool. If this has occurred, then most probably you have your virtual directory mapped to Classic .NET App Pool.

  1. Open IIS Manager ( Run -> inetmgr)
  2. In IIS Manager, Select Application Pools.
  3. Right Click -> Classic .NET App Pool. Click Advanced Settings
  4. Browse to the Identity Property in Process Model.
  5. Change it from ApplicationPool Identity to Local System.

You should be all set. Refer screenshots below.

image005.jpg

image006.jpg

Problem #4 - Problem hosting HHTP Handlers (IIS 7.5, OS – Windows 7)

I faced this problem when I was trying to host a HTTP Handler in IIS 7.5. I placed my dll in the Bin folder of my virtual directory and set up a web.config file with the necessary ISAPI filter mapping. When I was trying to access the HTTP handler, I got the following error message –

HTTP Error 500.23 - Internal Server Error

An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode.

This might be because your virtual directory is mapped to an Application Pool which has Managed Pipeline Mode = Integrated. You need to change it to Classic. To do that follow either of the following

Method #1 – Change the Managed Pipeline mode of the Application Pool that your virtual directory is mapped to. By default your virtual directory will be mapped to the DefaultAppPool which works on Integrated Managed Pipeline mode.

  1. Open IIS manager (Run -> inetmgr)
  2. Click on Application Pools. Select the DefaultAppPool -> Double Click
  3. Change the managed Pipeline Mode from Integrated to Classic.

image007.jpg

 

Method #2 – Create a new Application for your virtual directory

  1. In Inetmgr -> Select your Web Directory
  2. Right Click -> Remove
  3. Right Click -> Select Convert to Application.
  4. Select Classic.NetAppPool.

You should be all set. In either case you are mapping your Virtual Directory to communicate using Classic Managed Pipeline Mode.

Refer screenshots below

image008.jpg

image009.jpg

image010.jpg

Summary

I hope this document helps explain some of the common obscure problems with IIS. I plan to add more information as I get them. Readers are welcome to add and share their experiences as well.

License

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

About the Author

anshudutta
Software Developer (Senior)
Singapore Singapore
Member
I am a Senior Software Developer / Technical Consultant in a leading software company. I have 6+ years of development experience in .NET, VB, C# and SQL

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   
QuestionReading Registry or .ini files from ISAPI ExtensionmemberRoland Smith4 Feb '11 - 12:34 
I am using IIS 7.5 on Windows 7 64bit. My extension is written in C with VS2005.
 
I tried to have my extension get at settings from HKEY_LOCAL_MACHINE part of the registry but couldn't get it to work. I changed it to use GetPrivateProfileString to read an .ini file. It works ok but only if the .ini file is in C:\Windows. It can't find the .ini file in any other folder on the system path.
 
I am getting the settings in the GetExtensionVersion function.
 
Please advise.
 
Roland
GeneralAnother IIS 7.5 issuememberMarosA13 Oct '10 - 23:11 
http://blogs.iis.net/wonyoo/archive/2009/06/18/workaround-running-asp-net-1-1-on-vista-sp2-ws08-sp2.aspx
Generala different problemmemberSeishin#22 Sep '10 - 4:46 
In my firm we've got a strange problem..
after uploading new version of a site (sources, not publish) the application doesn't recompile or see the changes whatsoever..
we have to turn off application, turn off it's apppool, turn on apppool and then turn on application to make the site "refresh"...
 
we've got IIS6 on virtual windows server 2003 SE SP2..
 
have you encountered this kind of issues?
life is study!!!

GeneralRe: a different problemmemberanshudutta22 Sep '10 - 8:32 
No I haven't seen this one. But if you can send me the details and its possible root cause I can include this in my post.
 
thanks!
GeneralRe: a different problemmemberSeishin#22 Sep '10 - 8:33 
Actually I was hoping you'd have some solution :P
life is study!!!

QuestionDuplicate Image and ApplicationPool IdentitymemberErik Anderson21 Sep '10 - 5:23 
Problem #2 - Cannot see Windows authentication in IIS (IIS 7.5, OS – Windows 7)
The image for enabling Windows Authentication in the Windows Features dialog is shown twice. Did you intend to show a different image?
 
Problem #3 - Error - Login failed for user 'IIS APPPOOL\Classic .NET

What are the implications of changing the identity for ApplicationPool Identity to Local System? Why not create a new application pool specifically for your web service? What is your reasoning behind the change?
 
Overall, some nice tips there. Thanks!
AnswerRe: Duplicate Image and ApplicationPool IdentitymemberMember 711767421 Sep '10 - 18:35 
Yes, this is a duplicate image. Thanks for pointing out.
 
When you change the application pool identity to LocalSystem, you are actually changing the privilege under which your application pool is running. I think the Local System has more privileges than the default one. This is only by best guess. I found the solution by trial and error and it works!!
GeneralRe: Duplicate Image and ApplicationPool IdentitymemberInfRes21 Sep '10 - 23:55 
Incidently, changing your app to run as local system is a bad idea too.
 
Essentially, thats giving any applications running in that app pool admin access to your system, so
if someone hacks your app, and can do a buffer overflow on it, they could potentially do anything to your system.
 
Given that you're using windows authentication, I'm assuming that this is an internal app rather than a internet app, which makes it ok to use this technique, however better techniques would be to set up an account esspecially for the app-pool, or to use impersonation
GeneralRe: Duplicate Image and ApplicationPool Identitymemberanshudutta29 Sep '10 - 4:10 
You have a valid point. Let me try and use impersonation rather than giving my web service increased privilege.
Answer500.23 Internal ErrormemberInfRes20 Sep '10 - 22:54 
I think the 500.23 Internal Error is actually caused by using an older construct to add the HTTP Handler in the web config... I'd need to see the web.config to be sure though.
 
Either way, integrated pipeline mode shouldn't be the cause of the problems.
 
See Here: http://mvolo.com/blogs/serverside/archive/2007/12/08/IIS-7.0-Breaking-Changes-ASP.NET-2.0-applications-Integrated-mode.aspx[^]
 
You'll note that you can change to Classic Mode, but applying the workaround such that you can use integrated mode is 'Strongly Recommended'
 
Good well written and concise article

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 20 Sep 2010
Article Copyright 2010 by anshudutta
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid