Http-handler load error

别说谁变了你拦得住时间么 提交于 2019-12-13 13:27:11

问题


I successfully added and configured HttpHandler in an Asp.Net WebApplication, but facing problems while trying to add same HttpHandler to Asp.Net WebSite. I have registered it in the web.config, am i missing something

This is the error I am getting

 Configuration Error

    Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. 

    Parser Error Message: Could not load type 'MyHandler'.

    Line 98:     </pages>
    Line 99:     <httpHandlers>
    Line 100:      <add verb="*" path="*.result" type="MyHandler"/>
    Line 101:      <remove verb="*" path="*.asmx"/>

Here is handler

public class MyHandler: IHttpHandler
{
    #region IHttpHandler Members

    public bool IsReusable
    {
        get { return true; }
    }

    public void ProcessRequest(HttpContext context)
    {
    }
    #endregion
}

NOTE: I have not made any request for the handler via url, it is just not letting me run application.

Thanks


回答1:


Edit: I missed the WebSite at first:

Put the .cs in App_code and use this:

<add verb="*" path="*.result" type="MyHandler, App_Code"/>



回答2:


Try using the fully-qualified type name in your type attribute, including the assembly name. Like this:

<add verb="*" path="*.result" type="Namespace.MyHandler,AssemblyName" />


来源:https://stackoverflow.com/questions/2168451/http-handler-load-error

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