无法识别的配置节 system.web.extensions
我使用 .NET 4.0 和 JSON 创建了一个网站。我现在尝试在远程主机服务器(网络解决方案)上托管该网站,打开网站时出现以下错误:
web.config 文件中的配置部分 system.web.extensions 无法识别。
我打电话给他们的支持人员,他们说他们只能托管 .NET 3.5 网站,而不能托管 .NET 4.0(他们的服务器上没有 .NET 4.0 框架)。
是否有解决方法可以使其在 .NET 3.5 框架中工作?
这是我的配置文件:
<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="myCompany.PropertySystem" type="myCompany.PropertySystem.Configuration.PropertyConfigurationSectionGroup">
<section name="dataProviders" type="myCompany.PropertySystem.Configuration.PropertyDataProviderConfigurationSection, myCompany.PropertySystem"/>
</sectionGroup>
</configSections>
<system.web>
<globalization culture="en-US" uiCulture="en-US"/>
<compilation debug="true" targetFramework="4.0" defaultLanguage="c#">
</compilation>
<authentication mode="Forms">
<forms loginUrl="~/Login.aspx" />
</authentication>
<httpHandlers>
<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="*" 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="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="GET, POST" path="Upload.ashx" type="myCompany.PropertySystem.Web.Handlers.UploadHandler, myCompany.PropertySystem"/>
</httpHandlers>
<httpModules>
<add name="SriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</httpModules>
<trace enabled="false" pageOutput="true" mostRecent="true" requestLimit="150"/>
<customErrors mode="Off"></customErrors>
<pages validateRequest="false" enableViewState="false" enableEventValidation="false" controlRenderingCompatibilityVersion="3.5">
<controls>
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</controls>
</pages>
<webServices>
<protocols>
<add name="HttpGet"/>
</protocols>
</webServices>
<sessionState mode="InProc" cookieless="UseCookies" timeout="120"></sessionState>
<httpRuntime executionTimeout="120" maxRequestLength="524288"/>
</system.web>
<system.web.extensions>
<scripting>
<webServices>
<jsonSerialization maxJsonLength="500000000"/>
</webServices>
</scripting>
</system.web.extensions>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<handlers>
<remove name="WebServiceHandlerFactory-Integrated"/>
<remove name="ScriptHandlerFactory"/>
<remove name="ScriptHandlerFactoryAppServices"/>
<remove name="ScriptResource"/>
<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedModule" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedModule" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="ScriptResource" verb="GET,HEAD" path="ScriptResource.axd" preCondition="integratedModule" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="Upload" verb="GET,POST" path="Upload.ashx" type="myCompany.PropertySystem.Web.Handlers.UploadHandler, myCompany.PropertySystem"/>
</handlers>
<defaultDocument>
<files>
<remove value="iisstart.htm"/>
<remove value="index.html"/>
<remove value="index.htm"/>
<remove value="Default.asp"/>
<remove value="Default.htm"/>
</files>
</defaultDocument>
</system.webServer>
<appSettings>
<add key="SiteID" value="700"/>
<add key="SiteName" value="My Company"/>
<add key="SiteVirtualPath" value="~/"/>
<add key="StartPage" value="~/Default.aspx"/>
<!-- Email server values-->
<add key="SmtpServer.Name" value=""/>
<add key="SmtpServer.Port" value=""/>
<add key="SmtpServer.UserName" value=""/>
<add key="SmtpServer.Password" value=""/>
<add key="Notifications.From" value=""/>
<add key="Notifications.To" value=""/>
<add key="Notifications.Cc" value=""/>
<add key="HandlerAcceptedReferrers" value=""/>
<!-- Upload path-->
<add key="UploadPath" value="~/Uploads"/>
<add key="PropertyApplicationServerUrl" value="http://localhost/PropertySystem/"/>
<add key="RedirectToPropertyApplicationUrl" value="false"/>
</appSettings>
<connectionStrings>
<add name="myCompany.PropertySystem.Data.Providers.PropertyManagementDataProvider" connectionString="Data Source=MYCOMPANY;Initial Catalog=MyCompanyDB;User ID=sa;Password=somepwd;Persist Security Info=False;" providerName="System.Data.SqlClient"/>
</connectionStrings>
<myCompany.PropertySystem>
<dataProviders>
<dataProvider name="PropertyManagementDataProvider" providerType="myCompany.PropertySystem.Data.Providers.PropertyManagementDataProvider, myCompany.PropertySystem" connectionString="@myCompany.PropertySystem.Data.Providers.PropertyManagementDataProvider" defaultSchema="dbo" defaultCommandTimeout="120" cachingEnabled="true" defaultCacheDuration="00.00:30:00">
</dataProvider>
</dataProviders>
</myCompany.PropertySystem>
</configuration>
I created a web site using .NET 4.0 with JSON. I am now trying to host the site on a remote host server (Network Solutions) and I get the following error when I open the web site:
Unrecognized configuration section system.web.extensions in web.config file.
I called their support and they said they can only host .NET 3.5 web sites and not .NET 4.0 (they don't have .NET 4.0 framework on their servers).
Is there a workaround to make this work in a .NET 3.5 framework?
Here is my config file:
<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="myCompany.PropertySystem" type="myCompany.PropertySystem.Configuration.PropertyConfigurationSectionGroup">
<section name="dataProviders" type="myCompany.PropertySystem.Configuration.PropertyDataProviderConfigurationSection, myCompany.PropertySystem"/>
</sectionGroup>
</configSections>
<system.web>
<globalization culture="en-US" uiCulture="en-US"/>
<compilation debug="true" targetFramework="4.0" defaultLanguage="c#">
</compilation>
<authentication mode="Forms">
<forms loginUrl="~/Login.aspx" />
</authentication>
<httpHandlers>
<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="*" 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="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="GET, POST" path="Upload.ashx" type="myCompany.PropertySystem.Web.Handlers.UploadHandler, myCompany.PropertySystem"/>
</httpHandlers>
<httpModules>
<add name="SriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</httpModules>
<trace enabled="false" pageOutput="true" mostRecent="true" requestLimit="150"/>
<customErrors mode="Off"></customErrors>
<pages validateRequest="false" enableViewState="false" enableEventValidation="false" controlRenderingCompatibilityVersion="3.5">
<controls>
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</controls>
</pages>
<webServices>
<protocols>
<add name="HttpGet"/>
</protocols>
</webServices>
<sessionState mode="InProc" cookieless="UseCookies" timeout="120"></sessionState>
<httpRuntime executionTimeout="120" maxRequestLength="524288"/>
</system.web>
<system.web.extensions>
<scripting>
<webServices>
<jsonSerialization maxJsonLength="500000000"/>
</webServices>
</scripting>
</system.web.extensions>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<handlers>
<remove name="WebServiceHandlerFactory-Integrated"/>
<remove name="ScriptHandlerFactory"/>
<remove name="ScriptHandlerFactoryAppServices"/>
<remove name="ScriptResource"/>
<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedModule" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedModule" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="ScriptResource" verb="GET,HEAD" path="ScriptResource.axd" preCondition="integratedModule" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="Upload" verb="GET,POST" path="Upload.ashx" type="myCompany.PropertySystem.Web.Handlers.UploadHandler, myCompany.PropertySystem"/>
</handlers>
<defaultDocument>
<files>
<remove value="iisstart.htm"/>
<remove value="index.html"/>
<remove value="index.htm"/>
<remove value="Default.asp"/>
<remove value="Default.htm"/>
</files>
</defaultDocument>
</system.webServer>
<appSettings>
<add key="SiteID" value="700"/>
<add key="SiteName" value="My Company"/>
<add key="SiteVirtualPath" value="~/"/>
<add key="StartPage" value="~/Default.aspx"/>
<!-- Email server values-->
<add key="SmtpServer.Name" value=""/>
<add key="SmtpServer.Port" value=""/>
<add key="SmtpServer.UserName" value=""/>
<add key="SmtpServer.Password" value=""/>
<add key="Notifications.From" value=""/>
<add key="Notifications.To" value=""/>
<add key="Notifications.Cc" value=""/>
<add key="HandlerAcceptedReferrers" value=""/>
<!-- Upload path-->
<add key="UploadPath" value="~/Uploads"/>
<add key="PropertyApplicationServerUrl" value="http://localhost/PropertySystem/"/>
<add key="RedirectToPropertyApplicationUrl" value="false"/>
</appSettings>
<connectionStrings>
<add name="myCompany.PropertySystem.Data.Providers.PropertyManagementDataProvider" connectionString="Data Source=MYCOMPANY;Initial Catalog=MyCompanyDB;User ID=sa;Password=somepwd;Persist Security Info=False;" providerName="System.Data.SqlClient"/>
</connectionStrings>
<myCompany.PropertySystem>
<dataProviders>
<dataProvider name="PropertyManagementDataProvider" providerType="myCompany.PropertySystem.Data.Providers.PropertyManagementDataProvider, myCompany.PropertySystem" connectionString="@myCompany.PropertySystem.Data.Providers.PropertyManagementDataProvider" defaultSchema="dbo" defaultCommandTimeout="120" cachingEnabled="true" defaultCacheDuration="00.00:30:00">
</dataProvider>
</dataProviders>
</myCompany.PropertySystem>
</configuration>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,您应该检查iis应用程序池并确保它正在运行.net 4.0。 (右键单击 iis 中的站点并查看属性,您应该也能够更改它在那里使用的框架。)
并确保稍后在命令提示符中运行“iisreset”命令。
Yes, you should check the iis application pool and make sure it is running .net 4.0. (Right click on the site in iis and see the property, and you should be able to change the framework it uses there too.)
and make sure you run "iisreset" command in command prompt later.