首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >.NET 3.5作为.NET 4.0在IIS7中的应用

.NET 3.5作为.NET 4.0在IIS7中的应用
EN

Stack Overflow用户
提问于 2011-12-28 15:33:34
回答 1查看 3.8K关注 0票数 1

我在IIS7中遇到了一个阻止web.config继承的问题。我有一个.NET 3.5应用程序,它是IIS 7中.NET 4.0应用程序的子应用程序。我得到了一个可怕的错误:

配置节'system.web.extensions‘无法读取,因为它缺少节声明

我尝试将父system.web中的整个web.config元素封装在location标记中,其中inheritInChildApplications设置为false,allowOverRide设置为true,如下所示:

代码语言:javascript
复制
<location path="."  inheritInChildApplications="false" allowOverRide="true">
<system.web>
    .....
</system.web>

然而,无论我尝试了什么,我都无法对子应用程序的行为进行任何更改。谁来帮帮忙。

编辑:

下面是整个web.config:

代码语言:javascript
复制
<configSections>
    <section name="AppConfig" type="WebCommon.WebAppConfig, WebCommon" />
    <section name="exceptionManagement" type="Microsoft.ApplicationBlocks.ExceptionManagement.ExceptionManagerSectionHandler,Microsoft.ApplicationBlocks.ExceptionManagement" />
    <section name="infragistics.web" type="System.Configuration.SingleTagSectionHandler,System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
    <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
        <section name="appt.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    </sectionGroup>
</configSections>
<system.web.extensions>
    <scripting>
        <webServices>
            <jsonSerialization maxJsonLength="500000">
            </jsonSerialization>
        </webServices>
    </scripting>
</system.web.extensions>
<system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <modules>
        <remove name="ScriptModule" />
        <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    </modules>
    <handlers>
        <remove name="AboMapperCustom-475393366" />
        <remove name="AboMapperCustom-475393336" />
        <remove name="AboMapperCustom-475393333" />
        <remove name="WebServiceHandlerFactory-ISAPI-2.0" />
        <add name="ar_rpx-integrated" path="*.rpx" verb="*" type="DataDynamics.ActiveReports.Web.Handlers.RpxHandler" resourceType="File" preCondition="integratedMode" />
        <add name="ar_activereport-integrated" path="*.ActiveReport" verb="*" type="DataDynamics.ActiveReports.Web.Handlers.CompiledReportHandler" resourceType="Unspecified" preCondition="integratedMode" />
        <add name="ar_arcacheitem-integrated" path="*.ArCacheItem" verb="*" type="DataDynamics.ActiveReports.Web.Handlers.WebCacheAccessHandler" resourceType="Unspecified" preCondition="integratedMode" />
        <add name="Telerik_Web_UI_WebResource_axd" verb="*" preCondition="integratedMode" path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" />
    </handlers>
    <defaultDocument>
        <files>
            <remove value="Default.htm" />
            <remove value="Default.aspx" />
        </files>
    </defaultDocument>
    <httpWarmup>
        <requests>
            <add requestUrl="\login.aspx" allowedResponseCodes="200-399" warmupContext="" sendMode="Asynchronous" />
        </requests>
    </httpWarmup>
</system.webServer>
<connectionStrings>
    .....
</connectionStrings>


<appSettings>
    .....
</appSettings>
<exceptionManagement>
    <!-- <publisher mode="on" assembly="WebCommon" 
           type="WebCommon.CustomExceptionPublishers.ExceptionPublisherToFile" 
           fileName="c:\CustomPub.log"/>
-->
    <publisher mode="on" assembly="WebCommon" type="WebCommon.CustomExceptionPublishers.ExceptionPublisherToDB" fileName="c:\CustomPub2.log" />
</exceptionManagement>
<AppConfig>
    .....
</AppConfig>

<system.web>

    <roleManager enabled="true">
        <providers>
            <remove name="AspNetSqlRoleProvider" />
            <add connectionStringName="appt.My.MySettings.ConnectionString" applicationName="/" name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
            <remove name="AspNetWindowsTokenRoleProvider" />
        </providers>
    </roleManager>

    <webParts>
        <personalization defaultProvider="AspNetSqlPersonalizationProvider">
            <providers>
                <remove name="AspNetSqlPersonalizationProvider" />
                <add name="AspNetSqlPersonalizationProvider" type="System.Web.UI.WebControls.WebParts.SqlPersonalizationProvider" connectionStringName="appt.My.MySettings.ConnionString" applicationName="/" />
            </providers>
        </personalization>
    </webParts>
    <xhtmlConformance />
    <!--  DYNAMIC DEBUG COMPILATION
      Set compilation debug="true" to insert debugging symbols (.pdb information)
      into the compiled page. Because this creates a larger file that executes
      more slowly, you should set this value to true only when debugging and to
      false at all other times. For more information, refer to the documentation about
      debugging ASP.NET files.
-->
    <compilation defaultLanguage="vb" debug="false">
        <assemblies>
            <add assembly="ActiveReports.Web, Version=6.2.3681.0, Culture=neutral, PublicKeyToken=CC4967777C49A3FF" />
            <add assembly="ActiveReports.HtmlExport, Version=6.2.3681.0, Culture=neutral, PublicKeyToken=cc4967777c49a3ff" />
            <add assembly="ActiveReports.PdfExport, Version=6.2.3681.0, Culture=neutral, PublicKeyToken=cc4967777c49a3ff" />
            <add assembly="System.Data.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
            <add assembly="System.Data.Services.Client, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
            <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
            <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
            <add assembly="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
            <add assembly="System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
            <add assembly="System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
            <add assembly="System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
            <add assembly="System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
            <add assembly="System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
            <add assembly="System.Web.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
            <add assembly="System.DirectoryServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
            <add assembly="System.DirectoryServices.Protocols, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
            <add assembly="System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
            <add assembly="System.ServiceProcess, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
            <add assembly="System.Web.RegularExpressions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
            <add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
            <add assembly="System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
            <add assembly="System.ServiceModel.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
            <add assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
            <add assembly="Infragistics4.WebUI.Shared.v11.1, Version=11.1.20111.2064, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" />
            <add assembly="Infragistics4.WebUI.UltraWebNavigator.v11.1, Version=11.1.20111.2064, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" />
            <add assembly="Infragistics4.WebUI.WebDataInput.v11.1, Version=11.1.20111.2064, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" />
            <add assembly="Infragistics4.WebUI.UltraWebGrid.v11.1, Version=11.1.20111.2064, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" />
            <add assembly="Infragistics4.WebUI.WebDateChooser.v11.1, Version=11.1.20111.2064, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" />
            <add assembly="Infragistics4.WebUI.UltraWebTab.v11.1, Version=11.1.20111.2064, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" />
            <add assembly="Infragistics4.WebUI.UltraWebToolbar.v11.1, Version=11.1.20111.2064, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" />
            <add assembly="Infragistics4.WebUI.Misc.v11.1, Version=11.1.20111.2064, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" />
            <add assembly="Infragistics4.WebUI.UltraWebGrid.ExcelExport.v11.1, Version=11.1.20111.2064, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" />
            <add assembly="Infragistics4.WebUI.WebCombo.v11.1, Version=11.1.20111.2064, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" />
            <add assembly="Infragistics4.WebUI.UltraWebChart.v11.1, Version=11.1.20111.2064, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" />
        </assemblies>
    </compilation>
    <!--  CUSTOM ERROR MESSAGES
      Set customErrors mode="On" or "RemoteOnly" to enable custom error messages, "Off" to disable. 
      Add <error> tags for each of the errors you want to handle.
-->
    <customErrors defaultRedirect="http://qc.somewhere.com/exception.aspx" mode="Off" />
    <!--  AUTHENTICATION 
      This section sets the authentication policies of the application. Possible modes are "Windows", 
      "Forms", "Passport" and "None"
-->
    <authentication mode="Forms">
        <!--Keep auth timeout greater than session timeout so that 
         Session_OnEnd in global.asax will fire first and always kill the auth cookie
         to make sure one doesn't outlast the other.
         In other words, Session timeout drives the user's experience      /Joe 01.25.02-->
        <forms name="AUTH" path="/" loginUrl="login.aspx" protection="All" timeout="30" />
    </authentication>
    <machineKey validationKey="C50B3C89CB21F4F1422FF158A5B42D0E8DB8CB5CDA1742572A487D9401E3400267682B202B746511891C1BAF47F8D25C07F6C39A104696DB51F17C529AD3CABE" decryptionKey="8A9BE8FD67AF6979E7D20198CFEA50DD3D3799C77AF2B72F" validation="SHA1" />
    <!--  AUTHORIZATION 
      This section sets the authorization policies of the application. You can allow or deny access
      to application resources by user or role. Wildcards: "*" mean everyone, "?" means anonymous 
      (unauthenticated) users.
-->
    <authorization>
        <deny users="?" />
        <!-- Allow all users -->
        <!--  <allow     users="[comma separated list of users]"
                         roles="[comma separated list of roles]"/>
              <deny      users="[comma separated list of users]"
                         roles="[comma separated list of roles]"/>
        -->
    </authorization>
    <!--  APPLICATION-LEVEL TRACE LOGGING
      Application-level tracing enables trace log output for every page within an application. 
      Set trace enabled="true" to enable application trace logging.  If pageOutput="true", the
      trace information will be displayed at the bottom of each page.  Otherwise, you can view the 
      application trace log by browsing the "trace.axd" page from your web application
      root. 
-->
    <trace enabled="false" requestLimit="10" pageOutput="true" traceMode="SortByTime" localOnly="true" />
    <!--  SESSION STATE SETTINGS
      By default ASP.NET uses cookies to identify which requests belong to a particular session. 
      If cookies are not available, a session can be tracked by adding a session identifier to the URL. 
      To disable cookies, set sessionState cookieless="true".
-->
    <sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data source=127.0.0.1;user id=sa;password=" cookieless="false" timeout="2" />
    <!--  PREVENT SOURCE CODE DOWNLOAD
      This section sets the types of files that will not be downloaded. As well as entering
      a httphandler for a file type, you must also associate that file type with the xspisapi.dll
      in the App Mappings property of the web site, or the file can be downloaded.
      It is recommended that you use this section to prevent your sources being downloaded.
-->
    <!--    <httpHandlers>
        <add verb="*" path="*.vb" type="System.Web.HttpNotFoundHandler,System.Web" />
        <add verb="*" path="*.cs" type="System.Web.HttpNotFoundHandler,System.Web" />
        <add verb="*" path="*.vbproj" type="System.Web.HttpNotFoundHandler,System.Web" />
        <add verb="*" path="*.csproj" type="System.Web.HttpNotFoundHandler,System.Web" />
        <add verb="*" path="*.webinfo" type="System.Web.HttpNotFoundHandler,System.Web" />
    </httpHandlers>
-->
    <!--  GLOBALIZATION - This section sets the globalization settings of the application. -->
    <globalization requestEncoding="utf-8" responseEncoding="utf-8" />
    <!-- ASMX is mapped to a new handler so that proxy javascripts can also be served. -->
    <httpHandlers>
        <add path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" validate="false" />
        <remove verb="*" path="*.asmx" />
        <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false" />
        <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />

        <!--
    <add verb="*" path="*.ashx" type="System.Web.UI.SimpleHandlerFactory"/>
    -->
    </httpHandlers>
    <httpModules>
        <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    </httpModules>
    <pages theme="Default" styleSheetTheme="Default">
        <controls>
            <add tagPrefix="telerik" namespace="Telerik.Web.UI" assembly="Telerik.Web.UI" />
            <add namespace="System.Web.UI" assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" tagPrefix="asp" />
            <add tagPrefix="asp" namespace="AjaxControlToolkit" assembly="AjaxControlToolkit" />
            <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        </controls>
    </pages>
</system.web>
<location path="/Feeds/RSS.aspx" inheritInChildApplications="false">
    <system.web>
        <authorization>
            <allow users="*" />
        </authorization>
    </system.web>
</location>

<system.codedom>
    <compilers>
        <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
            <providerOption name="CompilerVersion" value="v4.0" />
            <providerOption name="OptionInfer" value="true" />
            <providerOption name="WarnAsError" value="false" />
        </compiler>
    </compilers>
</system.codedom>
<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>
            <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35" />
            <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="4.0.0.0" />
        </dependentAssembly>
        <dependentAssembly>
            <assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35" />
            <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="4.0.0.0" />
        </dependentAssembly>
    </assemblyBinding>
</runtime>
<system.serviceModel>
    <bindings>
        <wsHttpBinding>
            <binding name="LinkService" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
                <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />
                <security mode="None">
                    <transport clientCredentialType="Windows" proxyCredentialType="None" realm="" />
                    <message clientCredentialType="Windows" negotiateServiceCredential="true" />
                </security>
            </binding>
        </wsHttpBinding>
    </bindings>
    <client>
        <endpoint address="http://192.168.1.1/2011-10/LinkService.svc/link" binding="wsHttpBinding" bindingConfiguration="LinkService" contract="OnboardingLinkService.ILinkService" name="LinkService" />
    </client>
</system.serviceModel>

EN

回答 1

Stack Overflow用户

发布于 2011-12-29 16:14:44

我认为您可以使用<remove />元素从父配置中删除元素。

或者仅仅使用<clear/>来清理整个部分

其实我只是自己试过。我没有遇到任何问题。我的环境如下。Win2008R2 +IS7.5

Site\AspNet4 4->用于asp.net 4应用程序

Site\AspNet4 4\AspNet4 35->用于Asp.net 3.5应用程序(这是一个虚拟文件夹)

我所做的就是把

代码语言:javascript
复制
 <location path="." inheritInChildApplications="false" allowOverride="true">
     <system.web>
        <compilation debug="true" targetFramework="4.0" />
     </system.web>
  </location>

我认为你的web.config有问题。

你为什么不发出来呢?

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/8657819

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档