C# 无法承载具有system.web.extensions的网站
我正在开发一个.NET4.0Web应用程序,在IIS上托管它。该应用程序在未使用C# 无法承载具有system.web.extensions的网站,c#,asp.net,iis,web-config,iis-6,C#,Asp.net,Iis,Web Config,Iis 6,我正在开发一个.NET4.0Web应用程序,在IIS上托管它。该应用程序在未使用web.config文件中的的情况下成功托管了几次 发布应用程序时没有任何错误,但当我尝试使用IIS托管应用程序并尝试启用目录浏览时,它会在配置节system.web中发出错误,无法读取扩展,因为它缺少节声明。我已经从应用程序池中将其设置为.NET4.0应用程序,但仍然给出了错误 下面是我的web.config文件 <?xml version="1.0"?> <!-- For mor
web.config
文件中的
的情况下成功托管了几次
发布应用程序时没有任何错误,但当我尝试使用IIS
托管应用程序并尝试启用目录浏览
时,它会在配置节system.web中发出错误,无法读取扩展,因为它缺少节声明
。我已经从应用程序池中将其设置为.NET4.0应用程序,但仍然给出了错误
下面是我的web.config
文件
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="MySql.Data, Version=6.5.4.0, Culture=neutral, PublicKeyToken=C5687FC88969C44D"/>
<add assembly="System.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
</assemblies>
</compilation>
<httpRuntime requestValidationMode="2.0" executionTimeout="1000" maxRequestLength="2147483647" />
</system.web>
<system.web.extensions>
<scripting>
<webServices>
<jsonSerialization maxJsonLength="2147483647">
</jsonSerialization>
</webServices>
</scripting>
</system.web.extensions>
</configuration>
我可以知道我在这里做错了什么吗..这是一个非常头痛的问题,我已经尝试了大多数在线资源,但都建议将应用程序池设置为.net 4.0
,我已经这样做了
非常感谢您的帮助:)
将其添加到配置部分。奇怪的是,它在applicationHost.config中没有默认设置您可以通过在webconfig文件中添加以下配置设置来解决此问题
<configSections>
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="Everywhere"/>
</sectionGroup>
</sectionGroup>
</sectionGroup>
</configSections>
如果您在IIS上上载4.0应用程序,并将应用程序池设置为2.0-3.5集成管道,则您将看到关于缺少扩展节声明的错误
您需要在IIS上设置4.0-4.5集成管道的应用程序池。ahhh我需要将其添加到
applicationHost.config
对吗?我现在正在尝试,并将发回:)让我澄清一下。通常,它存在于applicationHost.config中,因此您不需要在app.config中设置它,但是如果缺少它,您可以将其添加到任意位置。实际上,这是最好、最简单的解决方案。
<configSections>
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="Everywhere"/>
</sectionGroup>
</sectionGroup>
</sectionGroup>
</configSections>