iis解析错误的编号_使用IIS使用通用处理程序解析错误

What made me curious is that the generic handler works just fine when I'm running the Web App in a Visual Studio ASP.NET Development Server. When I change the config to run it directly from IIS the handler just dies.

It's an image handler, it writes back an array of bytes to be rendered in an Image object. As I said, it works fine in VS Development Server, but fails on IIS. It doesn't even get called...

The error I get when I'm trying to call it directly is this:

Parser Error Description: An error occurred during the parsing of a

resource required to service this request. Please review the following

specific parse error details and modify your source file

appropriately. Parser Error Message: Could not create type

'YourImageHandler'. Source Error: Line 1:

Language="C#" CodeBehind="YourImagehandler.ashx.cs"

Class="YourImageHandler" %>

Handler on web.config:

The Generic Handler is in the same assembly of the Web Project, and the whole thing is running on IIS 7.

解决方案

If you are using IIS 7 in pipeline mode then the handler definition must be in

Like this:

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.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值