locked
HttpHandler to process custom extension Pipelinemode: Classic not working but works with Integrated RRS feed

  • Question

  • User661536685 posted

    Hi,

    I have a small web app running on IIS 7.0 and Windows Vista.
    This web app has a reference to NewHandler.dll assembly .

    NewHandler assembly contains a class that implements IHttpHandler to process
    requests that come from pages with *.15seconds extenstion.

    web app is currently running using .NET Integrated Application pool andd
    the web.config has a section that maps the handler to process *.15seconds pages.

     <system.webServer>
            <handlers>
                <add name="15SecondsHandler" path="*.15seconds" verb="*" type="MyHandler.MyHandler.NewHandler" resourceType="Unspecified" />
            </handlers>
    </system.webServer>

    This setup works ok and I get the right output on a page that has .15seconds extension.

    Then I change the application pool to Classic .Net App Pool (.Net Framework 2.0) which should pick up this section from web.config for handling requests 

    <system.web>
     <httpHandlers>
            <add verb="*" path="*.15seconds" type="MyHandler.MyHandler.NewHandler" />
          </httpHandlers>
    </system.web>


    but instead of correctly processing mypage.15seconds page I get this error:

    =====================
    Server Error in Application "Default Web Site/natapp"
    HTTP Error 500.0 - Internal Server Error

    Description: Handler "15SecondsHandler" has a bad module "ManagedPipelineHandler" in its module list

    Error Code: 0x8007000d

    Notification: ExecuteRequestHandler

    Module: IIS Web Core

    Requested URL: http://localhost:80/natapp/mypage.15seconds

    Physical Path: D:\Learning\natapp\natapp\mypage.15seconds

    Logon User: Anonymous

    Logon Method: Anonymous

    Failed Request Tracing Log Directory: C:\inetpub\logs\FailedReqLogFiles

    Handler: 15SecondsHandler

    Most likely causes:

        * A module is referenced in configuration, but the module has not been installed or the name of the module is misspelled.
        * IIS received the request; however, an internal error occurred during the processing of the request. The root cause of this error depends on which module handles the request and what was happening in the worker process when this error occurred.
        * IIS was not able to access the web.config file for the Web site or application. This can occur if the NTFS permissions are set incorrectly.
        * IIS was not able to process configuration for the Web site or application.
        * The authenticated user does not have permission to use this DLL.

    What you can try:

        * Verify that the module is installed. The error description may contain additional information to help you determine which module is causing the error.
        * If the module is installed, verify that the module name is not misspelled in the configuration/system.webServer/handlers config section.
        * Ensure that the NTFS permissions for the web.config file are correct and allow access to the Web server's machine account.
        * Check the event logs to see if any additional information was logged.
        * Verify the permissions for the DLL.
        * Create a tracing rule to track failed requests for this HTTP status code. For more information about creating a tracing rule for failed requests, click here.

    More Information... This error means that there was a problem while processing the request. The request was received by the Web server, but during processing a fatal error occurred, causing the 500 error.

    Microsoft Knowledge Base Articles:

    *

    Server Version Information: Internet Information Services 7.0.
    ==================

    I have a larger app which build on .NET Framework 1.1 which also produces the same error.

    I would appreciate if anyone could shed some light on this

    Many thanks

    N

    Wednesday, December 13, 2006 7:25 AM

All replies

  • User1356161706 posted

    Natalex,

     Didn't you forget to mention something?

    It looks like you removed the integratedMode preCondition from the following entry in the globalModules section of applicationhost.config:

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

    Now webengine.dll gets loaded into Application Pools that run in classic Mode. webengine.dll is IIS7 module that loads managed modules into the IIS7 pipeline and it can't run in classic Mode.

     Hope this helps.


     

    Wednesday, December 13, 2006 11:35 AM
  • User511787461 posted

    Your configuration should look something like this - the first entry applies to integrated mode, the second to classic mode, 64-bit, v2.0, the third to classic mode, 32-bit, v2.0 and the last to v1.1 (which can only be classic mode and 32-bits).

    <system.webServer>
            <handlers>
                <add name="15SecondsHandler-Integrated" path="*.15seconds" verb="*" type="MyHandler.MyHandler.NewHandler" resourceType="Unspecified" preCondition="integratedMode" />
                <add name="15SecondsHandler-ISAPI-2.0-64" path="*.15seconds" verb="*" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll" resourceType="Unspecified" preCondition="classicMode,runtimeVersionv2.0,bitness64" />
                <add name="15SecondsHandler-ISAPI-2.0-32" path="*.15seconds" verb="*" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" resourceType="Unspecified" preCondition="classicMode,runtimeVersionv2.0,bitness32" />
                <add name="15SecondsHandler-ISAPI-1.1" path="*.15seconds" verb="*" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll" resourceType="Unspecified" preCondition="runtimeVersionv1.1" />
            </handlers>
    </system.webServer>

    <system.web>
     <httpHandlers>
            <add verb="*" path="*.15seconds" type="MyHandler.MyHandler.NewHandler" />
          </httpHandlers>
    </system.web>

    Wednesday, December 13, 2006 6:42 PM
  • User661536685 posted

    Thomad,

    I have checked this configuration and it was in tact already.

     

     

    Thursday, December 14, 2006 12:08 PM
  • User661536685 posted

    Anilr,

    I have followed your recommendations and was able to get it working.

    I had a section for system.webserver missing.

    I am now looking at a larger project that I am trying to get ot work on IIS 7.0.

    This project is written in VS2003 (.Net Framework 1.1) and also makes use of HttpHandlers.

    I have read this article http://www.iis.net/default.aspx?tabid=2&subtabid=25&i=993 and added <section name="system.webserver" type="System.Configuration.IgnoreSectionHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> to machine.config for .NET Framework 1.1.

    The application pool is also set to ASP.NET 1.1

    This has solved the problem of unrecognized configuration for <system.webserver> element.

    However, there is another thing that I do not know how to set up.

    Setting this web app in IIS 6.0 required for a directory members/content to register the file extensions used in web app with IIS so that they will go through the GetContent HttpHandler (a part of the web app project). The following steps were required to complete registration of extenstions:

     - Go to the Members/content folder and right click to select Properties.
    - Click the “Create” button to create a new application. Click the “Configuration” button, when it becomes active.
     - Add each file extension used by clicking the “Add” button. The following path should be used for each file extension registered: C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll. Limit to GET, with only the “check script engine” checkbox checked. The “check file exists” checkbox should be UNCHECKED.

    The following file extensions should be registered .ext1, .ext2, .ext3
     Click the “Remove” button to remove the assets application. This will keep the settings.

    I would appreciate any help that you may provide.

    What should be added to Web.config?


     

    Thursday, December 14, 2006 12:25 PM
  • User511787461 posted
    You can use similar system.webServer/handlers configuration as above in the web.config file for that directory to make that work - again you may need to put multiple lines if you want to work with multiple versions of asp.net etc
    Thursday, December 14, 2006 1:22 PM
  • User661536685 posted

    Hi Anilr,

    I have tried to do that but it does not work. So, instead I again created a small web app /natapp1 in VS 2003 and .NET Framework 1.1 that runs on my IIS 7.0.

    I have a class ExtHandler in my web app that implements IHttpHandler called Extension handler for extension *.ext1. I also have a file text.you1 which is a blank file. The assembly name is natapp1.

    The contents of the class and web.config are listed below.

    However, these configuration still fail to output text.ext1 page correctly and instead I get 404.3 error message.

    Please find the contents of the error message, the class and the web.config files below.

    The application pool for the web app is set to ASP .NET 1.1.

    === Here is an error message ====

    Server Error in Application "Default Web Site/natapp1"


    HTTP Error 404.3 - Not Found

    Description: The page you are requesting cannot be served because of the Multipurpose Internet Mail Extensions (MIME) map policy that is configured on the Web server. The page you requested has a file name extension that is not recognized, and is not allowed.

    Error Code: 0x80070032

    Notification: ExecuteRequestHandler

    Module: StaticFileModule

    Requested URL: http://localhost:80/natapp1/text.ext1

    Physical Path: C:\inetpub\wwwroot\natapp1\text.ext1

    Logon User: Anonymous

    Logon Method: Anonymous

    Failed Request Tracing Log Directory: C:\inetpub\logs\FailedReqLogFiles

    Handler: StaticFile

    ===== End of error ===========

    ===== Here is a class =====

    ' Asset retrieval handler

    Imports System.Web

    Imports System.Web.SessionState

    Imports System.IO

    Public Class ExtHandler

    Implements IHttpHandler

    Implements IReadOnlySessionState

    Public ReadOnly Property IsReusable() As Boolean Implements System.Web.IHttpHandler.IsReusable

    Get

    Return True

    End Get

    End Property

    Public Sub ProcessRequest(ByVal context As System.Web.HttpContext) Implements System.Web.IHttpHandler.ProcessRequest

    context.Response.Write("Hello there")

    context.Response.End()

    End Sub

    End Class

    ==== End of class =====

    Here is web config

    ==== Web.config =====

    <?xml version="1.0" encoding="utf-8" ?>

    <configuration>

     

    <system.web>

    <!-- DYNAMIC DEBUG COMPILATION

    Set compilation debug="true" to insert debugging symbols (.pdb information)

    into the compiled page. Because this creates a larger file that executes

    more slowly, youeshould set this value to true only when debugging and to

    false at all other times. For more information, refer to the documentation about

    debugging ASP.NET files.

    -->

    <compilation defaultLanguage="vb" debug="true" />

    <!-- CUSTOM ERROR MESSAGES

    Set customErrorsemode="On" or "RemoteOnly" to enable custom error messages, "Off" to disable.

    Add <error> tagsfor each of the errors you want to handle.

    "On" Always display custom (friendly) messages.

    "Off" Always display detailed ASP.NET error information.

    "RemoteOnly" Display custom (friendly) messages only to users not running

    on the local Web server. This setting is recommended for security purposes, so

    that you do notedisplay application detail information to remote clients.

    -->

    <customErrors mode="RemoteOnly" />

    <!-- AUTHENTICATION

    This section sets the authentication policies of the application. Possible modes are "Windows",

    "Forms", "Passport" and "None"

    "None" No authentication is performed.

    "Windows" IIS performs authentication (Basic, Digest, or Integrated Windows) according to

    its settings for the application. Anonymous access must be disabled in IIS.

    "Forms" You provide a custom form (Web page) for users to enter their credentials, and then

    you authenticate them in your application. A user credential token is stored in a cookie.

    "Passport" Authentication is performed via a centralized authentication service provided

    by Microsoft that offers a single logon and core profile services for member sites.

    -->

    <authentication mode="Windows" />

     

    <!-- AUTHORIZATION

    This section sets the authorization policies of the application. You can allow or deny access

    to application resources by user or role. Wildcards: "*" mean everyone, "?" means anonymous

    (unauthenticated) users.

    -->

    <authorization>

    <allow users="*" /> <!-- Allow all users -->

    <!-- <allow users="[comma separated list of users]"

    roles="[comma separated list of roles]"/>

    <deny e users="[comma separated list of users]"

    e roles="[comma separated list of roles]"/>

    -->

    </authorization>

    <!-- APPLICATION-LEVEL TRACE LOGGING

    Application-level tracing enables trace log output for every page within an application.

    Set trace enabled="true" to enable application trace logging. If pageOutput="true", the

    trace information will be displayed at the bottom of each page. Otherwise, you can view the

    application trace log by browsing the "trace.axd" page from your web application

    root.

    -->

    <trace enabled="false" requestLimit="10" pageOutput="false" traceMode="SortByTime" localOnly="true" />

     

    <!-- SESSION STATE SETTINGS

    By default ASP.NET uses cookies to identify which requests belong to a particular session.

    If cookies are not available, a session can be tracked by adding a session identifier to the URL.

    To disable cookies, set sessionState cookieless="true".

    -->

    <sessionState

    mode="InProc"

    stateConnectionString="tcpip=127.0.0.1:42424"

    sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"

    cookieless="false"

    timeout="20"

    />

    <!-- GLOBALIZATION

    This section sets the globalization settings of the application.

    -->

    <globalization requestEncoding="utf-8" responseEncoding="utf-8" />

     

    <httpHandlers>

    <add verb="*" path="*.ext1" type="natapp1.ExtHandler, natapp1" />

    </httpHandlers>

     

    </system.web>

    <system.webserver>

    <handlers>

    <add name="nat1Handler-Integrated" path="*.ext1" verb="*" type="natapp1.ExtHandler" resourceType="Unspecified" preCondition="integratedMode" />

    <add name="nat1Handler-ISAPI-2.0-32" path="*.ext1" verb="*" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" resourceType="Unspecified" preCondition="classicMode,runtimeVersionv2.0,bitness32" />

    <add name="nat1Handler-ISAPI-1.1" path="*.ext1" verb="*" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll" resourceType="Unspecified" preCondition="runtimeVersionv1.1" />

    </handlers>

    </system.webserver>

    </configuration>

    ==== Web.config =====

     

    Friday, December 15, 2006 5:21 AM
  • User661536685 posted

    Please note I meant "a class named ExtHandler" instead of "a class named Extension handler"

    Friday, December 15, 2006 5:23 AM
  • User661536685 posted

    Hi,

    I have got it working!

    Here is the correct version of system.web and system.webServer config file:

    <system.web>

    <httpHandlers>

    <add verb="*" path="*.ext1" type="natapp1.ExtHandler, natapp1" />

    </httpHandlers>

    </system.web>

    <system.webServer>

    <handlers>

    <add name="nat1Handler-Integrated" path="*.ext1" verb="*" type="natapp1.ExtHandler, natapp1" resourceType="Unspecified" preCondition="integratedMode" />

    <add name="nat1Handler-ISAPI-2.0-32" path="*.ext1" verb="*" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" resourceType="Unspecified" preCondition="classicMode,runtimeVersionv2.0,bitness32" />

    <add name="nat1Handler-ISAPI-1.1" path="*.ext1" verb="*" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll" resourceType="Unspecified" preCondition="runtimeVersionv1.1" />

    </handlers>

    </system.webServer>

    =============

    Why for ASP .NET 1.1 I still need system.webServer section even though in my machine.config file it is set to be ignored?

    Is there a white paper that addresses this particular scenario?

    Many thanks,

    Nat

    Friday, December 15, 2006 7:54 AM
  • User661536685 posted

    Hi,

    I have got it working!

    Here is the correct version of system.web and system.webServer config file:

    <system.web>

    <httpHandlers>

    <add verb="*" path="*.ext1" type="natapp1.ExtHandler, natapp1" />

    </httpHandlers>

    </system.web>

    <system.webServer>

    <handlers>

    <add name="nat1Handler-Integrated" path="*.ext1" verb="*" type="natapp1.ExtHandler, natapp1" resourceType="Unspecified" preCondition="integratedMode" />

    <add name="nat1Handler-ISAPI-2.0-32" path="*.ext1" verb="*" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" resourceType="Unspecified" preCondition="classicMode,runtimeVersionv2.0,bitness32" />

    <add name="nat1Handler-ISAPI-1.1" path="*.ext1" verb="*" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll" resourceType="Unspecified" preCondition="runtimeVersionv1.1" />

    </handlers>

    </system.webServer>

    =============

    Why for ASP .NET 1.1 I still need system.webServer section even though in my machine.config file it is set to be ignored?

    Is there a white paper that addresses this particular scenario?

    Many thanks,

    Nat

    Friday, December 15, 2006 7:54 AM
  • User704942467 posted
    Should this also fix running ASP.NET Ajax on Vista?
    Monday, January 15, 2007 10:43 PM