【发布时间】:2011-11-11 08:11:10
【问题描述】:
我在网上阅读了很多关于这个问题的文章和问题,但我没有找到适合我的问题的解决方案。
我有一个 Web 应用程序(父级),其中包含多个 Web 应用程序。
子应用程序有自己的 web.config 文件,并设置为 IIS (7.5) 中的应用程序。
在根应用程序中,我设置了<location> 标签:
<location path="." inheritInChildApplications="false">
<system.web>
<compilation debug="true" targetFramework="4.0">
</compilation>
<authentication mode="Forms"/>
<customErrors mode="Off" />
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
<controls>
<add tagPrefix="web" namespace="CustomControls" assembly="YouSites"/>
<add tagPrefix="web" namespace="YouSites.Code" assembly="YouSites"/>
<add tagPrefix="web" tagName="ScriptLoader" src="~/UserControls/ScriptLoader.ascx"/>
<add tagPrefix="web" tagName="ParameterControl" src="~/UserControls/ParameterControl.ascx"/>
</controls>
</pages>
</system.web>
</location>
在子应用程序中,我设置了以下几行:
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
<controls>
<add tagPrefix="web" tagName="Content" src="~/UserControls/Content.ascx"/>
<add tagPrefix="web" tagName="DynamicBox" src="~/UserControls/DynamicBox.ascx"/>
<add tagPrefix="web" tagName="GlobalStyle" src="~/UserControls/GlobalStyle.ascx"/>
<add tagPrefix="web" tagName="Image" src="~/UserControls/Image.ascx"/>
<add tagPrefix="web" tagName="String" src="~/UserControls/String.ascx"/>
<add tagPrefix="web" namespace="ApiShared.CustomControls.Frame" assembly="ApiShared"/>
</controls>
</pages>
现在,当子应用程序启动时,我收到以下错误:
Server Error in '/Layouts/vital' Application.
--------------------------------------------------------------------------------
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Unknown server tag 'web:GlobalStyle'.
Source Error:
Line 7: <script type="text/javascript" src="Assets/jquery-1.4.3.js"></script>
Line 8: <script type="text/javascript" src="Assets/jquery.simplemodal-1.4.1.js"></script>
Line 9: <web:GlobalStyle runat="server" />
Line 10: <title></title>
Line 11: </head>
我的想法是子 web.config 仍然从主 web.config 继承,路径很好,但我认为它甚至没有从子 web.config 文件中读取。
提前致谢,
盖尔
【问题讨论】:
标签: asp.net web-config