使用APP_ code在web.config中定义的类 [英] Using a class defined in App_Code in web.config

查看:292
本文介绍了使用APP_ code在web.config中定义的类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一类名为 CustomWebAuditEvent APP_ code / CustomWebAuditEvent.vb 定义,我试图用它在我的的web.config一个eventMappings

I have a class named CustomWebAuditEvent defined in App_Code/CustomWebAuditEvent.vb and I'm trying to use it in a eventMappings of my Web.Config

<healthMonitoring enabled="true">
  <eventMappings>
    <clear />
    <add name="HandeledException"
         type="CustomWebAuditEvent"
     />
  </eventMappings>
....

我得到的错误信息:

I got the error message:

未能加载类型CustomWebAuditEvent

Could not load type 'CustomWebAuditEvent'

所以,我想

  • TYPE =CustomWebAuditEvent,APP_ code
  • TYPE =CustomWebAuditEvent,APP_ code.CustomWebAuditEvent
  • TYPE =CustomWebAuditEvent,__ code
  • TYPE =CustomWebAuditEvent,__ code.CustomWebAuditEvent
  • type="CustomWebAuditEvent, App_Code"
  • type="CustomWebAuditEvent, App_Code.CustomWebAuditEvent"
  • type="CustomWebAuditEvent, __Code"
  • type="CustomWebAuditEvent, __Code.CustomWebAuditEvent"

和我的一切是这样的错误信息:

and all I got is this error message :

无法加载文件或程序集APP_ code或它的某一个依赖。   该系统找不到指定的文件。

Could not load file or assembly 'App_Code' or one of its dependencies. The system cannot find the file specified.

我怎么能做出这样的工作?

How could I make this work?

推荐答案

我把我的CustomWebAuditEvent类成分离的类库,并把编译的程序集在我的bin文件夹。

I moved my CustomWebAuditEvent class into a separated class library and put the compiled assembly in my bin folder.

注:我发现这另一个问题描述的准确同样的问题。

Note: I found this other question that describe the exact same problem.

这篇关于使用APP_ code在web.config中定义的类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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