Parse error with Generic Handler using IIS

妖精的绣舞 提交于 2019-12-04 18:43:54

If you are using IIS 7 in pipeline mode then the handler definition must be in <System.webServer> Like this:

<system.webServer>
<handlers>
    <add name="YourImageHandlerName" path="*.ashx" verb="*" type="YourImageHandler" />
</handlers>
</system.webServer>

Check here: http://blogs.msdn.com/b/tmarq/archive/2007/08/30/iis-7-0-asp-net-pipelines-modules-handlers-and-preconditions.aspx

IIS 7.0 has two pipeline modes: integrated and classic. The latter is sometimes referred to as ISAPI mode.

Integrated mode allows both managed and native modules to register for events in the IIS pipeline. This enables many new scenarios, such as applying ASP.NET forms authentication to non-asp.net requests (static files, classic ASP files, etc).

Classic mode is identical to IIS 6.0. In classic mode, the ASP.NET pipeline (BeginRequest, AuthenticateRequest,…, EndRequest) runs entirely within the IIS pipeline’s EXECUTE_REQUEST_HANDLER event. Think of ASP.NET in classic mode as a pipeline within a pipeline.

The other option is to run your site in "classic" mode, in classic mode IIS 7 works like IIS 6 and has the same behaviour (for what matters here) as your Cassini web server.

Hope that help.

You have to add preCondition attribute in web.config file

    <add name="HandlerName" verb="*" path="Handlers/HandlerName.ashx" type="Namespace/HandlerClassName, MyAssembly, Version=1.0.*, Culture=neutral" preCondition="classicMode,runtimeVersionv4.6.1"/>

Its working for my error now.

kkaya

I think you should add a managed handler mapping to IIS. it is not enough to add config. You can look here .

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!