开发者

Unable to set jsonSerialization in Azure

开发者 https://www.devze.com 2023-01-11 17:32 出处:网络
The app I\'m trying to put in Azure was built in ASP.NET 3.5, and I converted it to 4.0 when moving it to the cloud.Everything works great, until I try to add this block to my web.config:

The app I'm trying to put in Azure was built in ASP.NET 3.5, and I converted it to 4.0 when moving it to the cloud. Everything works great, until I try to add this block to my web.config:

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

This line causes the web role to stick in Busy state forever.

Here is the whole 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>
  ...
 </co开发者_Go百科nnectionStrings>
 <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>

Any suggestions would be great! Again, removing the system.web.extensions section and everything works fine (except the code that needs the overridden maxJsonLength).

I've also tried doing a local deploy of System.Web.Extensions. No go there either.

Thanks!


I had the same issue. The workaround by Yi-Lin Luo in this thread did it for me. This should be added in the configSections; otherwise, jsonSerialization won't be recognized in the Azure environment.

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


Is it really working if that line is omitted? Seems like a case of this: http://social.msdn.microsoft.com/Forums/en/windowsazure/thread/6c739db9-4f6a-4203-bbec-eba70733ec16

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号