2011-12-27 113 views
0

我創建了一個使用.NET 4.0和JSON的網站。我現在試圖在遠程主機服務器(網絡解決方案)上託管該站點,並在打開網站時出現以下錯誤:無法識別的配置節system.web.extensions

無法識別的配置節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> 
+0

您的開發環境中是否已經切換回.Net 3.5?因爲如果你不能託管4.0正確的配置文件將是你問題最少的 – rene 2011-12-27 17:21:15

+0

不,我聯繫了他們的技術支持人員,看看他們是否可以在他們的Web服務器上切換到.NET 4.0。他們實際上在其服務器上使用.NET 2.0作爲該網站。等待聽到他們回來。 – user1100221 2011-12-27 19:12:42

回答

0

是的,你應該檢查IIS應用程序池,並確保它在.NET 4.0下運行。 (右鍵單擊iis中的站點並查看屬性,您應該也可以更改其在此處使用的框架。)

並確保在稍後的命令提示符中運行「iisreset」命令。

相關問題