【问题标题】:HttpHandler not workingHttpHandler 不工作
【发布时间】:2014-04-10 19:23:44
【问题描述】:

我正在尝试将 FileUpload 项目从 vid.ly 集成到我的 Web 应用程序,该应用程序使用 Razor 引擎在 MVC ASP .NET 4 框架中。

我在 App_Code 下有一个 HttpHandler。 Progress.cs

public class Progress : IHttpHandler
{
 ...
}

我在从 Globals.asax 调用的 RegisterRoutes() 中添加了这个:

routes.IgnoreRoute("Progress.progress");

并在 web.config 的 system.web 部分添加了这些行:

<httpHandlers>
    <add verb="*" path="*.progress" type="MyNamespace.Progress"/>
</httpHandlers>

当我尝试打开 http://localhost:39234/Progress.progress 时,我收到 HTTP Error 404.0 - Not Found 错误,并提供以下详细信息:

Requested URL      http://localhost:39234/Progress.progress
Physical Path      c:\users\xxxxx\documents\visual studio 2012\Projects\SolutionName\ProjectName\Progress.progress

映射似乎有问题。有谁知道我错过了什么?

【问题讨论】:

    标签: asp.net-mvc mapping httphandler


    【解决方案1】:

    我终于弄清楚了问题所在。我必须以这种格式将映射放在system.webServer 部分:

    <add name="Progress" verb="*" path="*.progress" type="MyNamespace.Progress,MyNamespace"/>
    

    或者,将 Progress.cs 文件的 Action Build Path 设置为“Content”,这样它就不会在 MyNamespace.dll 中编译

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-05-19
      • 2010-11-30
      • 2017-03-13
      • 1970-01-01
      • 1970-01-01
      • 2012-10-27
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多