Configuring IIS7 to server both a wildcard ISAPI DLL and static files

iis-7isapi

I have an ISAPI DLL that is configured in IIS for wild card mapping. When a request URL corresponds to a static file, I want IIS's StaticFileModule to serve that file. When the file doesn't exist, I want the ISAPI DLL to handle it.

The handlers section of my web.config, located in the root of the static files hierarchy, looks like this…

<handlers accessPolicy="Read, Script">
    <clear />
        <add name="SomeIsapiDll" path="*" verb="*" type="" 
            modules="IsapiModule" scriptProcessor="C:\my_site\some_isapi.dll" 
            resourceType="Unspecified" requireAccess="None" allowPathInfo="false" 
            preCondition="" responseBufferLimit="4194304" />
        <add name="StaticFile" path="*" verb="*" type="" 
            modules="StaticFileModule,DefaultDocumentModule" scriptProcessor="" 
            resourceType="Unspecified" requireAccess="None" allowPathInfo="false" 
            preCondition="" responseBufferLimit="4194304" />
</handlers>

This works for the requests intended for the ISAPI DLL but static files are returned as 404. If I reverse the order, I just get blank pages with no content for any requests. If I remove the ISAPI DLL from web.config, static files are correctly served but, of course, then the ISAPI requests aren't served.

My understanding is that cascading wild card handlers should work but the Microsoft docs that I can find are very vague about how to make this happen. It is possible that this is either a configuration problem or a problem with the ISAPI DLL implementation but at this point I have no idea. Thoughts?

Best Answer

We had the same problem, then we just added these:

<add name="aspnet_isapi 32-bit" path="*" verb="*" modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" resourceType="Unspecified" requireAccess="Script" preCondition="classicMode,runtimeVersionv2.0,bitness32" />

<add name="aspnet_isapi 64-bit" path="*" verb="*" modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll" resourceType="Unspecified" requireAccess="Script" preCondition="classicMode,runtimeVersionv2.0,bitness64" />