【发布时间】:2009-05-14 13:10:00
【问题描述】:
我不知道在 MVC 网站中发生这种情况是否相关,但我想我还是会提到它。
在我的 web.config 我有这些行:
<add verb="*" path="*.imu" type="Website.Handlers.ImageHandler, Website, Version=1.0.0.0, Culture=neutral" />
在网站项目中,我有一个名为 Handlers 的文件夹,其中包含我的 ImageHandler 类。看起来是这样的(我已经去掉了processrequest代码)
using System;
using System.Globalization;
using System.IO;
using System.Web;
namespace Website.Handlers
{
public class ImageHandler : IHttpHandler
{
public virtual void ProcessRequest(HttpContext context)
{
//the code here never gets fired
}
public virtual bool IsReusable
{
get { return true; }
}
}
}
如果我运行我的网站并转到 /something.imu,它只会返回 404 错误。
我正在使用 Visual Studio 2008 并尝试在 ASP.Net 开发服务器上运行它。
我一直在寻找几个小时,并让它在一个单独的空网站上工作。所以我不明白为什么它不能在现有网站中工作。顺便说一句,没有其他对 *.imu 路径的引用。
【问题讨论】:
标签: c# asp.net-mvc httphandler