基础 Web 应用程序中的 httpModule 未在子项目中加载
VB.Net 2k5 Web 应用程序
基本应用程序有一个带有 httpModules 部分的 web.config 文件:
子项目编译到与基本应用程序相同的 bin 文件夹,但我收到以下消息:
解析器错误消息:无法加载 文件或程序集 'Castle.MonoRail.Framework' 或其中之一 它的依赖项。系统不能 找到指定的文件。 (c:\inetpub\wwwroot\web.config 行 132)
来源错误:
第 131 行:[<]httpModules[>]
第 132 行: [<]添加名称=“单轨” 类型=“Castle.MonoRail.Framework.EngineContextModule”, Castle.MonoRail.Framework"/[>] --- 此处错误
线路 133: [<]添加名称=“ScriptModule” 类型=“System.Web.Handlers.ScriptModule”, 系统.Web.扩展, 版本=1.0.61025.0,文化=中立, PublicKeyToken=31bf3856ad364e35"/[>]
第 134 行: [<]添加名称=“活动记录” 类型=“Castle.ActiveRecord.Framework.SessionScopeWebModule”, Castle.ActiveRecord"/>
VB.Net 2k5 Web Application
The base application has a web.config file with an httpModules section:
The sub-project compiles to the same bin folder as the base application, but I get this message:
Parser Error Message: Could not load
file or assembly
'Castle.MonoRail.Framework' or one of
its dependencies. The system cannot
find the file specified.
(c:\inetpub\wwwroot\web.config line
132)Source Error:
Line 131: [<]httpModules[>]
Line 132: [<]add name="monorail"
type="Castle.MonoRail.Framework.EngineContextModule,
Castle.MonoRail.Framework"/[>] --- Error hereLine
133: [<]add name="ScriptModule"
type="System.Web.Handlers.ScriptModule,
System.Web.Extensions,
Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35"/[>]Line 134: [<]add name="active-record"
type="Castle.ActiveRecord.Framework.SessionScopeWebModule,
Castle.ActiveRecord"/>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我解决了这个问题。首先,是的,子项目正在构建到父 bin 文件夹中。
问题是,我将父文件夹和子文件夹都设置为 IIS 中的应用程序。我让孩子只是一个虚拟文件夹,问题就消失了。
为什么这有效?我尝试移动 HTTPModules,发现 MS ScriptModule 没有问题,但如果我先移动 ActiveRecord 模块,它就会出现问题。我认为如果这些模块尝试多次加载,就会出现问题。 (只是猜测。)
或者可能是子项的安全性,因为它是一个应用程序,不允许从另一个应用程序加载程序集。
现在正在处理其他问题。谢谢。
I resolved this. First, yes, the sub-project was building to the parent bin folder.
The issue was, I had both the parent and child folders set as applications in IIS. I made the child just a virtual folder, and the issue went away.
Why did this work? I tried shuffling around the HTTPModules, and found that the MS ScriptModule did not have the problem, but if I moved the ActiveRecord module first, it had the problem. I think that those modules have issues if they try to get loaded more than once. (Just a guess.)
Or it may have been that the security for the child, since it was an application, didn't allow loading assemblies from another application.
It is working now... on to other issues. Thanks.
您是否在 Web 应用程序项目中添加了对 Castle.MonoRail.Framework 的引用?
Have you added a reference to the Castle.MonoRail.Framework in your web app project?
您的子项目是否配置为使用父 bin 文件夹?
我假设这样的布局:
除非您更改了配置中的探测路径,否则子应用程序不会在父容器中看到任何内容。这适用于 web.config 中定义的任何内容,例如引用程序集的配置节、httpmodules 等。
is your sub-project configured to use the parent bin folder?
I'm assuming a layout like this:
unless you've changed the probing path in the config, subapp won't see anything in the parent bin. That goes for anything defined in the web.config, eg config sections, httpmodules, etc that reference assemblies.