Sheen Space

Web Development Study: ASP.Net 4 & IIS 7 hate each other?

leave a comment »


“PageHandlerFactory-Integrated” Issue

After environment set up, I started learning IIS 7 configuration. The first thing I want to do is to use ASP.Net 4 as default ASP.Net environment, replacing default ASP.Net 2. It appeared to be straightforward. I deployed example website from VS2010 to server; I changed the application pool’s .NET version to 4.0. When I tried to browse my website, it gave me this horrible error:

HTTP Error 500.21 – Internal Server Error

Handler “PageHandlerFactory-Integrated” has a bad module “ManagedPipelineHandler” in its module list

By googling internet, I find it is classic IIS and ASP.Net 4 configuration problem, and many forum threads are about it, like this one:

How to Fix “PageHandlerFactory-Integrated” bad module “ManagedPipelineHandler in IIS7

and this one:

Bad module “ManagedPipelineHandler” in its module list

However, after I tried all suggestions, website still gave same error message. Now I turn my notice to one line of settings in C:WindowsSystem32inetsrvconfigapplicationHost.config:

<add name="ManagedEngine" image="%windir%Microsoft.NETFrameworkv2.0.50727webengine.dll" preCondition="integratedMode,runtimeVersionv2.0,bitness32" />

If root managed engine is version 2.0, how can it handle later version of component? So I changed it to:

<add name="ManagedEngine" image="%windir%Microsoft.NETFrameworkv4.0.30319webengine4.dll" preCondition="integratedMode,runtimeVersionv4.0,bitness32" />

After I saved change, restart server and application pool, website is alive!

You must have noticed that there are 2 webengine DLLs under %windir%Microsoft.NETFrameworkv4.0.30319, webengine.dll and webengine4.dll. I am not sure what the difference is, and can’t get much information from Internet, but I guess webengine.dll becomes a wrapper or delegate to the new webengine4.dll. Because webengine.dll is 14K in size, but webengine4.dll is 481K, that is similar to webengine.dll (426K) in %windir%Microsoft.NETFrameworkv2.0.50727.

Question regarding basic authentication & authorization in IIS and ASP.Net

In addition, I asked a question on StackOverflow regarding IIS authentication and ASP.Net authorization:

Authentication settings in IIS 7.5 and ASP.Net, what is difference?

Issue with SQL Server Express provider services

Another issue regarding SQL Server user instance creation I met, is described here:

Problems with SQL Server Express user instancing and ASP.net Web Application Projects

In article below, author tells alternative workaround instead of using NETWORK SERVICE system account:

asp.net Auto-generated SQLEXPRESS database: Failed to generate a user instance of SQL Server ( troubleshooting 1 )

However, I notice that, not like what is shown in the article, in my Windows 7 system with IIS 7.5, DefaultAppPool user account doesn’t have user profile by default. Creating a user profile for it may not be such a good idea for whatever reason.

Advertisements

Written by Ying

07/10/2010 at 13:05

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: