DLL依赖和HTTP模块

发布于 2024-08-08 19:32:23 字数 498 浏览 2 评论 0原文

我在 dll 中有一个 HTTP 模块,正在 Web 应用程序中使用。我需要在 Web 应用程序中调用一个类(使用 dll 中定义的接口 - 所以我们不是紧密耦合的)。

我在 web.config 的应用程序设置中定义了该类,但无法弄清楚如何创建实例。我使用 Type.GetType 但它只返回 null。

我的 app.config 是

<add key ="ActiveClass" value ="WebApplication.Class1,WebApplication4">

,我的 Type.GetType 调用是

Type activeClassType = 
    Type.GetType(ConfigurationSettings.AppSettings["ActiveClass"] as string);  

任何帮助将不胜感激。

谢谢波奇

I have an HTTP module in a dll, being used in a web application. I need to call a class in the web application (using a Interface defined within the dll - so we are not tightly coupled).

I define the class in the appsettings of a web.config, but cannot figure how to create an instance. I use Type.GetType but it just returns a null.

My app.config is

<add key ="ActiveClass" value ="WebApplication.Class1,WebApplication4">

and my Type.GetType invocation is

Type activeClassType = 
    Type.GetType(ConfigurationSettings.AppSettings["ActiveClass"] as string);  

Any help would be gratefully received.

Thanks

Podge

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

猥琐帝 2024-08-15 19:32:23

我已经设法通过使用 appdomain 来做到这一点。

I have manage to do it by using appdomain.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文