2016-04-07 19 views
0

ben Şey alıyorum listesidir olduğunuJson dize uzunluğu asp.net web üzerinde en fazla

private void LoadCustomerControl() 
    { 
     try 
     { 
      IControlPanelPersistenceProvider persistenceProvider = new ControlPanelDatabaseProvider(); 
      List<CustomerDataGrid> customerCollection = persistenceProvider.ListCustomerGrid(false); 
      if (customerCollection != null && customerCollection.Count != 0) 
      { 
       cboCustomer.DataSource = null; 
       cboCustomer.DataSource = customerCollection; 
       cboCustomer.DataBind(); 
      } 
      else 
      { 
       //TODO add here message 
       m_btnSubbmit.Visible = false; 
       m_btnModifyCustomer.Visible = false; 
      } 
     } 
     catch (Exception ex) 
     { 

      string excep = ex.ToString(); 
      //TODO add log here 
     } 
    } 

aşağıdaki kodla, bir web formları sayfasında bir telerik DropDownList göstermek için çalışıyorum oluşturan aşıyor çok büyük ve o zaman bu tarayıcıda

İstisna mesajı hata yükseltir: seri veya seri kaldırma JSON JavaScriptSerializer kullanarak sırasında hata. Dizenin uzunluğu, maxJsonLength özelliğinde ayarlanan değerini aşıyor.

ben de yukarı yeni bir JavaScriptSerializer çalıştı

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

web config eklemek ve Int32.MaxLength için maxjsonlength var ayarlamak, veri kaynağı seri ve daha sonra Listesine geri serisini çalıştık CustomerDataGrid ancak hiçbiri işe yaramıyor.

o LoadCustomerControl çağrısı

cevap

0

deneyin ekleyerek < anahtar = eklemek AppSettings'i için aşağıdaki,

if (Request.QueryString.Get("customerId") != null && Request.QueryString.Get("customerId").Length > 0) 
      { 
       //Is comming from CustomerPage, display the customer 
       LoadCustomerControl(); 
       cboCustomer.SelectedValue = Request.QueryString.Get("customerId"); 
       cboCustomer.Text = GetCustomerName(int.Parse(Request.QueryString.Get("customerId").ToString())); 
       m_btnModifyCustomer.Visible = true; 
      } 
} 

teşekkür yoluyla yapılır "aspnet: MaxJsonDeserializerMembers" değerini = "2147483644"/>

+0

Bunu da denedim, aynı şans denedi – mitomed

+0

Bu stackoverflow iş parçacığına bakın. Yardımcı olabilir. http://stackoverflow.com/questions/9509721/jsonvalueproviderfactory-throws-request-too-large –

+0

Çok teşekkürler, sormadan önce gördüm. Bunun üzerinde harcanan saatler zaten ama hiçbir şey onu düzeltmek gibi görünüyor. – mitomed