如何添加一个HttpHandler到web.config? [英] How do I add an HttpHandler to the web.config?

查看:602
本文介绍了如何添加一个HttpHandler到web.config?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了的HttpHandler 来处理所有XSLT的请求。

处理程序的名称是 XSLTHandler.cs

的web.config

 <结构>
  <&的System.Web GT;
    <编译调试=真targetFramework =4.0/>
  <&HttpHandlers的GT;
    <添加动词=*路径=* XSL。TYPE =XSLTHandler/>
  < / HttpHandlers的>
  < /system.web>
< /结构>

我收到此错误信息,不知道如何解决它。


  

配置错误描述:在发生错误
  此请求提供服务所需的配置文件的处理。
  请检查下面的特定错误详细信息并修改
  配置文件恰如其分。


  
  

分析器错误信息:未能加载类型'XSLTHandler



解决方案

什么你缺少的是装配和命名空间XSLTHandler所属,的from MSDN 。所以,如果它位于当前的项目,它应该是这样的:

 <结构>
  <&的System.Web GT;
    <&HttpHandlers的GT;
      <添加动词=*路径=*。XSL
        键入=WebApplicationName.XSLTHandler,WebApplicationName/>
    < / HttpHandlers的>
  < /system.web>
< /结构>

I wrote a httphandler to handle all XSLT requests.

The name of the handler is XSLTHandler.cs.

web.config

<configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.0" />
  <httpHandlers>
    <add verb="*" path="*.xsl" type="XSLTHandler" />
  </httpHandlers>
  </system.web>
</configuration>

I got this error message, dont know how to fix it.

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 'XSLTHandler'.

解决方案

What you're missing is the assembly and namespace that XSLTHandler belongs in, from MSDN. So if it's located in your current project, it should look like this:

<configuration>
  <system.web>
    <httpHandlers>
      <add verb="*" path="*.xsl" 
        type="WebApplicationName.XSLTHandler, WebApplicationName" />
    </httpHandlers>
  </system.web>
</configuration>

这篇关于如何添加一个HttpHandler到web.config?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆