IIS6 虚拟目录无法作为应用程序访问
我有一个带有 IIS6 的 WinSrv2k3 盒子,托管一系列站点,其中一个是 VB/.NET2 站点。在其中我创建了一个虚拟目录并将其指向一个非常简单的 C#/.NET3.5 站点目录。我原本希望该站点允许我像普通站点一样查看页面(虚拟目录中只有一个 ASMX),但是当从浏览器访问该页面时,我得到:
Server Error in '/TestVbSite' Application.
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 file or assembly 'IMSControls' or one of its dependencies. The system cannot find the file specified. (D:\sites\TestVbSite\web.config line 211)
Source Error:
Line 209: </httpHandlers>
Line 210: <httpModules>
Line 211: <add name="UrlRewritingModule" type="IMS.Controls.HttpModules.UrlRewritingModule, IMSControls" />
Line 212: </httpModules>
Line 213: </system.web>
Source File: D:\sites\TestVbSite\web.config Line: 211
我在那里看到的问题是 web.xml 文件。引发异常的 config 似乎是父网站的 .config,而不是虚拟目录中的 web.config。但我不明白为什么。
当访问网站内的常规页面(不在虚拟目录下)时,它们会正常渲染和执行,这表明 IMSControls DLL 无法从虚拟目录加载,但同样,我不明白为什么这会涉及到的过程。
I have a WinSrv2k3 box with IIS6 hosting a series of sites, one of which is a VB/.NET2 site. Inside this I have created a virtual directory and pointed it at a very simple C#/.NET3.5 site's directory. I was expecting the site to allow me to view the pages as a normal site (there is only one ASMX in the virtual directory) but when accessing the page from a browser, I get:
Server Error in '/TestVbSite' Application.
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 file or assembly 'IMSControls' or one of its dependencies. The system cannot find the file specified. (D:\sites\TestVbSite\web.config line 211)
Source Error:
Line 209: </httpHandlers>
Line 210: <httpModules>
Line 211: <add name="UrlRewritingModule" type="IMS.Controls.HttpModules.UrlRewritingModule, IMSControls" />
Line 212: </httpModules>
Line 213: </system.web>
Source File: D:\sites\TestVbSite\web.config Line: 211
The issue I see there, is that the web.config throwing the exception appears to be the parent web site's .config, not the web.config in the virtual directory. But I don't understand why.
When accessing regular pages within the website (not under the virtual directory) they render and perform as normal, indicating that the IMSControls DLL is unable to load from the virtual directory, but again, I don't understand why this would even be involved in the process.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,在经历了一些错误的开始之后,大量的谷歌搜索给了我要寻找的正确的东西:web.config 继承。
基本上,要阻止虚拟目录继承其父站点的 web.config 的属性(以及因此产生的任何问题),父站点的 web.config 需要具有其
元素包裹在一个新的(对我来说)标签中:有用的链接:
http://forums.asp.net /t/1164283.aspx
http://dotnetslackers.com/Security/re- 55457_Stopping_ASP_NET_web_config_inheritance.aspx
http://msdn.microsoft.com/en -us/library/ms178685.aspx
Ok, well, after some false starts, heavy googling gave me the correct thing to look for: web.config inheritance.
Basically, to stop a virtual directory from inheriting the attributes of it's parent site's web.config (and therefore any problems from it) the parent site's web.config needs to have its
<system.web>
element wrapped in a new (to me) tag:Useful links:
http://forums.asp.net/t/1164283.aspx
http://dotnetslackers.com/Security/re-55457_Stopping_ASP_NET_web_config_inheritance.aspx
http://msdn.microsoft.com/en-us/library/ms178685.aspx