2010-07-09 60 views
9

時,因此,我們已經從3.5 SP1升級我們的網站服務器錯誤(500),載明下列配置組無法讀取:問題與<System.Web.Extensions程序>配置組升級到.NET 4.0

<system.web.extensions> 
     <scripting> 
      <scriptResourceHandler enableCompression="true" enableCaching="true" /> 
      <webServices> 
       <jsonSerialization maxJsonLength="999999" /> 
      </webServices> 
     </scripting> 
    </system.web.extensions> 

我們註釋掉這一節和網站運行得很好(但現在我們越來越問題JSON - 因爲上述要求的屬性) 。

我們已經閱讀了關於此問題的主題,其中大多數人都說「您的應用程序池未運行4.0」。而且,這不是問題。

我也讀過線程說IIS是不知何故閱讀舊的machine.config文件。

在.NET 4中,正如您所知,web.config中的很多部分已移至machine.config。

所以我們把這個部分回在web.config的頂部:

<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> 

和網站現在似乎工作正常。

不過,如果這是正確的解決方案,我有點擔心。

任何想法的人?這是正確的修復嗎?

編輯:

3周,沒有答案...該死的。 =)

+0

我也有同樣的問題,因爲你...我不知道爲什麼,但如果我不找出原因,我會回來給你這個線程。 – 2011-11-23 13:07:54

回答

2

由於我沒有答案,廣泛的谷歌搜索導致沒有愛,我決定堅持我原來的修補程序(將system.web.extensions部分添加到web.config中)。

0

還有兩點信息可能會幫助或不幫助。

  1. 與上面sectionGroup和我的機器sectionGroup的唯一區別是version = 3.5.0.0和version = 4.0.0.0在machine.config中。 1.
  2. 事件日誌中的錯誤是「無法加載所有ISAPI過濾器的網站...」可能是沒有正確註冊.net 4的System.Web.Extensions的安裝嗎?

我很想在這方面進行更多的測試,但不幸的是,我只在生產系統中看到這種行爲,而不是在開發系統中看到這種行爲。

2

我最近遇到這個問題,並能解決它後一些故障排除。希望我所做的將有助於解決您的問題。 1.確保您正在爲該網站運行的應用程序池正在使用.NET 4管道 2.在記事本中打開您的.csproj(或.vbproj,如果您的是VB項目)並瀏覽該文件並檢查是否有任何硬編碼引用v2.0框架文件。在我的情況下,我們有一個「After Build」任務,使用v2.0編譯器路徑強制應用程序仍然使用2.0運行時。它如下所示。

<Target Name=」AfterBuild」 Condition=」’$(MvcBuildViews)’==’true’」> 
<AspNetCompiler Condition=」’$(IsDesktopBuild)’ != ‘false’」 VirtualPath=」temp」 ToolPath=」$(WINDIR)\Microsoft.NET\Framework\v2.0.50727」 PhysicalPath=」$(ProjectDir)\..\$(ProjectName)」 /> 
<AspNetCompiler Condition=」’$(IsDesktopBuild)’ == ‘false’」 VirtualPath=」temp」 ToolPath=」$(WINDIR)\Microsoft.NET\Framework\v2.0.50727」 PhysicalPath=」$(OutDir)\_PublishedWebsites\$(ProjectName)」 /> 

確保將其更改爲V4.0甚至更好的讓他們confiurable。 希望有所幫助。

-Vamsi

相關問題