CultureInfo的对象时检测到循环引用

CultureInfo的对象时检测到循环引用

本文介绍了序列化类型为System.Globalization.CultureInfo的对象时检测到循环引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用jquery调用一个Web服务,该服务返回其中包含几个表的数据集.

I'm using jquery to call a webservice which returns a dataset with a couple of tables in it.

在我需要设置我的网络方法以接受参数之前,此方法工作正常.我用

This was working ok until i needed to set up my webmethod to accept a parameter. I reflected this on the client side with

data: "{paramname:'" + paramval+ "'}",

当web方法返回时,我现在收到以下错误.无论数据集中返回什么,都会发生这种情况

I now get the following error when the webmethod returns. This happens regardless of whats being returned in the dataset

当web方法没有参数时,客户端js看起来与以下相同,除了data:行被删除.

When the webmethod has no parameters the client side js looks the same as below except the data: line is removed.

function ClientWebService(paramval){
$.ajax({
    type: "POST",
    url: "WebService1.asmx/webmethodName",
    data: "{paramname:'" + paramval+ "'}",
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    success: function(msg) {
        ParseResult(msg.d);
    },
    error: function(err) {
        if (err.status == 200) {
              ParseResult(err);
        }
        else { alert('Error:' + err.responseText + '  Status: ' + err.status); }
    }
});

}

根据将请求更改为

data: {paramname: paramval},

产生以下错误.

推荐答案

我将web方法更改为返回

I changed my webmethod to return

ds.GetXml();

,并且有效.考虑到数据集是可序列化的,我不确定为什么必须这样做,但这使我克服了这一障碍.

and this worked. Considering datasets are serializeable I'm not sure why I have to do this, but it gets me over this hurdle.

这篇关于序列化类型为System.Globalization.CultureInfo的对象时检测到循环引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 09:59