0
當我在wcf服務中使用JavaScriptSerializer進行序列化時,它給出了定義代碼的以下錯誤。在c#中使用JavaScriptSerializer進行序列化時得到錯誤
代碼:
DataCollection<Entity> detailqueryentityCollection = _serviceProxy.RetrieveMultiple(detailquery).Entities;
if (detailqueryentityCollection.Count > 0)
{
listdata = new JavaScriptSerializer().Serialize(detailqueryentityCollection);
}
錯誤:
Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property.
我還添加下面的代碼在web.config中,但它不工作。
<system.web.extensions>
<scripting>
<webServices>
<jsonSerialization maxJsonLength="500000000"/>
</webServices>
</scripting>
</system.web.extensions>
請給我建議任何解決方案。
嗨威爾·雷,Thanx.Which你的建議和web.config中的變化同時需要改變?或者你給我足夠了? –
@chhaya_patel對於你的用例,你不需要配置文件部分。 –
嗨感謝您的幫助。 –