【问题标题】:asp.net 4.0 web.config inheritanceasp.net 4.0 web.config 继承
【发布时间】: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


    【解决方案1】:

    孩子确定在 IIS 中设置为应用程序吗?控制dll是否存在于childs bin目录中? GlobalStyle 控件是否已部署到子应用程序。它不嵌套时是否有效?

    基本上是在抱怨,因为类型无法解析。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-12-27
      • 2010-12-10
      • 2010-09-26
      • 1970-01-01
      • 2012-08-30
      • 2011-10-29
      • 1970-01-01
      • 2012-10-31
      相关资源
      最近更新 更多