Hosting .Net 4 website as child of .Net 3.5 website
I am trying to add a Silverlight application running on the .Net 4 Application Pool as a child application of a ASP.Net application running on the Classic .Net Application Pool开发者_StackOverflow中文版. I receive several configuration errors due to the Silverlight application inheriting configuration elements from the parent application. Does anyone know of an article, or some basic steps, that can help clarify the process of accomplishing this task?
Thank you
Move the system.web.extensions sectionGroup from the parent 3.5 web.config to the root 2.0 web.config located on the machine. You probably don't have to move all the sections, just "system.web.extensions". The 2.0 root web.config is located here: C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG or here:C:\Windows\Microsoft.NET\Framework64\v2.0.50727\CONFIG.
<configSections>
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" />
<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
<section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
</sectionGroup>
</sectionGroup>
</sectionGroup>
</configSections>
It seems strange to have to change the root web.config, but it does work.
You will also need to wrap section in the parent web.config with a location tag like so:
<location path="" inheritInChildApplications="false" >
<appSettings />
<connectionStrings />
<system.web>
<!-- Removed for brevity -->
</system.web>
<system.codedom>
<!-- Removed for brevity -->
</system.codedom>
<system.webServer>
<!-- Removed for brevity -->
</system.webServer>
</location>
See here:
ASP.NET 4 Child Applications Fail to Start When Under ASP.NET 2.0 or ASP.NET 3.5 Applications
The two applications (.NET 3.5 and .NET 4) will need to run in different application pools.
I.e. the child folder containing the .NET 4 application will need to be its own application, assigned to a different application pool.
However neither will be a Silverlight application --- they will be server profile .NET (Silverlight doesn't make sense, it is for client applications, not a web site).
精彩评论