2010-08-13 51 views
2

我試圖放在Azure中的應用程序是在ASP.NET 3.5中構建的,當將它轉移到雲時,我將它轉換爲4.0。一切都很好,直到我嘗試將此塊添加到我的web.config中:無法在Azure中設置jsonSerialization

<system.web.extensions> 
    <scripting> 
    <webServices> 
    <jsonSerialization maxJsonLength="10000000"></jsonSerialization> 
    </webServices> 
    </scripting> 
</system.web.extensions> 

此行導致Web角色永遠處於忙狀態。

這裏是整個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> 
<appSettings> 
    ... 
</appSettings> 
<system.diagnostics> 
    <trace> 
    <listeners> 
    <add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="AzureDiagnostics"> 
    <filter type="" /> 
    </add> 
    </listeners> 
    </trace> 
</system.diagnostics> 
<connectionStrings> 
    ... 
</connectionStrings> 
<system.web> 
    <customErrors mode="Off"/> 
    <compilation targetFramework="4.0"> 
    <assemblies> 
    <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" /> 
    </assemblies> 
    </compilation> 
    <httpHandlers> 
    <add path="Telerik.Web.UI.WebResource.axd" verb="*" type="Telerik.Web.UI.WebResource" validate="false" /> 
    </httpHandlers> 
</system.web> 
<system.webServer> 
    <modules runAllManagedModulesForAllRequests="true" /> 
    <validation validateIntegratedModeConfiguration="false" /> 
    <handlers> 
    <add name="Telerik_Web_UI_WebResource_axd" verb="*" preCondition="integratedMode" path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" /> 
    </handlers> 
</system.webServer> 
<system.web.extensions> 
    <scripting> 
    <webServices> 
    <jsonSerialization maxJsonLength="10000000"></jsonSerialization> 
    </webServices> 
    </scripting> 
</system.web.extensions> 
</configuration> 

任何建議將是巨大的!再次,刪除system.web.extensions部分和一切工作正常(除了需要重寫maxJsonLength的代碼)。

我也試過做System.Web.Extensions的本地部署。沒有去那裏。

謝謝!

+0

它運行在開發結構中嗎? – knightpfhor 2010-08-14 04:26:33

回答

1

我有同樣的問題。羅依林在this thread的解決方法爲我做了。這應該添加在configSections;否則,在Azure環境中將無法識別jsonSerialization

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