[英]ASP.NET handler not running on IIS7
我写了一个简单的处理程序:
public class ImageHandler : IHttpHandler, IRequiresSessionState
{
public bool IsReusable
{
get { return true; }
}
public void ProcessRequest(HttpContext context)
{
byte[] imgData = context.Session["Data"] as byte[];
if (imgData != null)
{
context.Response.CacheControl = "no-cache";
context.Response.Cache.SetCacheability(HttpCacheability.NoCache);
context.Response.ContentType = "image/png";
context.Response.BinaryWrite(imgData);
context.Response.Flush();
}
}
}
并设置web.config
:
<system.web>
<httpHandlers>
<add verb="GET" path="image.png" type="TestWeb.Handlers.ImageHandler, TestWeb" />
</httpHandlers>
</system.web>
<system.webServer>
<handlers>
<add name="Image" verb="GET" path="image.png" type="TestWeb.Handlers.ImageHandler, TestWeb" />
</handlers>
</system.webServer>
don't open a page. Wait for request from an external application
don't open a page. Wait for request from an external application
它永远不会到达处理程序 。 它不仅仅是断点,当我运行在IIS上配置的网站时,处理程序中没有代码执行。 只有从VS开始才有效。
配置IIS7时我错过了什么?
我不得不将应用程序池切换到Integrated
模式,它使用经典。
我不得不从<system.web>
删除处理程序配置,因为它给了我error 500.23
。
HTTP错误500.23 - 内部服务器错误检测到的ASP.NET设置不适用于集成管理管道模式。
你需要附加到asp.net工作进程。 转到工具/附加进程并选择w3p进程。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.