Приложение .NET 3.5 как дочерний элемент приложения .NET 4.0 в IIS7 - PullRequest
1 голос
/ 28 декабря 2011

У меня проблема с предотвращением наследования web.config в IIS 7. У меня есть приложение .NET 3.5, которое является дочерним приложением к приложению .NET 4.0 в IIS 7. Я получаю страшную ошибку:

Раздел конфигурации 'system.web.extensions' не может быть прочитан, так как в нем отсутствует объявление раздела

Я попытался обернуть весь элемент system.web в родительской сети.Конфигурация в теге местоположения с параметром attributeitInChildApplications, установленным в значение false, и параметром allowOverRide, равным true, как показано ниже:

<location path="."  inheritInChildApplications="false" allowOverRide="true">
<system.web>
    .....
</system.web>

Однако, что бы я ни пытался, мне не удалось получить какие-либосвоего рода изменение поведения дочернего приложения.Кто-то, пожалуйста, помогите.

РЕДАКТИРОВАТЬ:

Вот весь web.config:

<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>

1 Ответ

0 голосов
/ 29 декабря 2011

Я думаю, вы можете использовать элемент <remove /> для удаления элементов из родительского конфига.

Или просто использовать <clear/> для очистки всего раздела

На самом деле я только что попробовалсебя.Я не столкнулся с какой-либо проблемой.Моя среда выглядит следующим образом.Win2008R2 + IIS7.5

Сайт \ AspNet4 -> для приложения asp.net 4

Сайт \ AspNet4 \ AspNet35 -> для приложения Asp.net 3.5 (это виртуальная папка)

все, что я сделал, это просто положил

 <location path="." inheritInChildApplications="false" allowOverride="true">
     <system.web>
        <compilation debug="true" targetFramework="4.0" />
     </system.web>
  </location>

Я думаю, что-то не так в вашем web.config.

почему бы вам не опубликовать это?

...