简体   繁体   English

无法使用system.web.extensions托管网站

[英]Cannot host website with system.web.extensions

I am developing an .net 4.0 web application where I host it on IIS. 我正在开发一个.net 4.0 Web应用程序,我将它托管在IIS上。 The application was successfully hosted several times without the use of <system.web.extensions> in web.config file. 几次成功托管应用程序,而不使用web.config文件中的<system.web.extensions>

The application gets published without any errors, but when I try to host it using IIS and try to enable Directory Browsing it gives out the error The configuration section system.web,extensions cannot be read because its missing a section declaration . 应用程序发布时没有任何错误,但是当我尝试使用IIS托管它并尝试启用Directory Browsing它会发出错误The configuration section system.web,extensions cannot be read because its missing a section declaration I've already set it up as .net 4.0 application from the application pool but still gives the error. 我已经从应用程序池中将其设置为.net 4.0应用程序,但仍然提供错误。

Following is my web.config file, 以下是我的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>

May I know what i'm doing wrong here..this is such a headache and I've tried most of the resources online but all suggest to set the application pool to .net 4.0 which I have already done.. 我可以知道我在这里做错了什么..这是一个令人头疼的问题,我已经在线尝试了大部分资源,但都建议将应用程序池设置为我已经完成的.net 4.0

Many thanks for the help :) 非常感谢您的帮助 :)

<configuration>
  <configSections>
    <section name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup" />
  </configSections>
</configuration>

Add this to the configuration sections. 将其添加到配置部分。 Its weird that it isn't defaulted in the applicationHost.config 奇怪的是它在applicationHost.config中没有默认值

If you upload 4.0 application on IIS with app pool which is set for 2.0 - 3.5 Integrated Pipeline then you will see the error about missing a section declaration for extension. 如果您在IIS上运行4.0应用程序,其中应用程序池设置为2.0 - 3.5集成管道,那么您将看到有关缺少扩展的部分声明的错误。

You need to set on IIS the app pool for 4.0-4.5 Integrated Pipeline. 您需要在IIS上设置4.0-4.5集成管道的应用程序池。

You can solve the issue by adding following configuration setting in webconfig file 您可以通过在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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法解析System.Web.Extensions程序集 - System.Web.Extensions Assembly cannot be resolved System.Web.Extensions的用途是什么? - What is System.Web.Extensions for? 无法将System.Web.Extensions应用于PartialTrustVisibleAssemblies列表 - Cannot Apply System.Web.Extensions to PartialTrustVisibleAssemblies List 我在哪里可以找到程序集 System.Web.Extensions dll? - Where can I find the assembly System.Web.Extensions dll? C#Framework 4.5不包含System.Web.Extensions - c# framework 4.5 not include System.Web.Extensions 无法加载文件或程序集“ System.Web.Extensions” - Could not load file or assembly 'System.Web.Extensions' 无法添加System.Web.Extensions程序集作为参考 - can not add System.Web.Extensions Assembly as reference 如何添加 System.Web.Extensions 以使 JavaScriptSerializer 工作 - How to add System.Web.Extensions to get JavaScriptSerializer work 我是否需要web.config值配置 - &gt;运行时 - &gt; System.Web.Extensions的assemblyBinding? - Do I need the web.config values configuration -> runtime -> assemblyBinding for System.Web.Extensions? VS2010中2.0框架.net引用中缺少System.web.extensions引用dll? - System.web.extensions reference dll is missing from the 2.0 framework .net references in VS2010?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM