是否可以将 Global.asax 提取到网站 bin 目录之外的公共库中?
使用这个问题中的解决方案,我将 MvcApplication 逻辑移至 SharedHttpApplication 类在我继承自 HttpApplication 的公共库中。
在我的 asp.net mvc 3 项目中,我的 Global.asax MvcApplication 继承自 SharedHttpApplication。
我的公共库程序集位于服务器文件系统的标准位置,并且我试图避免必须复制本地以将其保存在一个位置。
我的 Global.asax 页面的第一行没有收到解析器错误。我读过这是因为 包含应用程序的 DLL 不在bin 目录。
有人对我在这里尝试做的事情有解决方案吗?
预先感谢您的任何帮助!
Using the solution in this question, I moved my MvcApplication logic to a SharedHttpApplication class in my common library that inherits from HttpApplication.
In my asp.net mvc 3 project, I have my Global.asax MvcApplication inherit from my SharedHttpApplication.
My common library Assembly lives on the server file system in a standard location, and I am trying to prevent having to copy local to keep it in one place.
I am not getting a parser error for line one of my Global.asax page. I've read this is because the DLL containing the application is not in the bin directory.
Does anyone have a solution for what I'm trying to do here?
Thanks in advance for any help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我相信您可以通过将共享 DLL 安装到 GAC 来实现您所说的目的的唯一方法。这将使服务器上的任何内容都可以访问它。如果您不关心其安全隐患,那么这可能是正确的选择。
http://msdn.microsoft.com/en-us/library/dkkx7f79.aspx
否则,将 dll 复制到应用程序的每个 bin 文件夹并不是真正糟糕的做法,只要您为此制定了良好的部署策略即可。
The only way I believe you can do what you're talking about it by installing the shared DLL to the GAC. That will make it accessible to anything on the server. If you don't care about the security implications of that, then that could be the way to go.
http://msdn.microsoft.com/en-us/library/dkkx7f79.aspx
Otherwise, copying the dll to each of the application's bin folders is not really bad practice, as long as you have a good deployment strategy in place for that.