当前位置: 代码迷 >> Web Service >> 用js取得返回的DataTable类型时,报错:A circular reference was detected while serializing an object of type 'System.Reflection.Module'解决方法
  详细解决方案

用js取得返回的DataTable类型时,报错:A circular reference was detected while serializing an object of type 'System.Reflection.Module'解决方法

热度:776   发布时间:2016-05-02 03:11:42
用js取得返回的DataTable类型时,报错:A circular reference was detected while serializing an object of type 'System.Reflection.Module'
创建了一个WebService,返回一个DataTable,代码如下:
C# code
    [WebService(Namespace = "http://tempuri.org/")]    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]    [ToolboxItem(false)]    [ScriptService]    public class Service1 : System.Web.Services.WebService    {        [WebMethod]        public DataTable GetData()        {            DataTable dt = new DataTable("testDT");            dt.Columns.Add(new DataColumn("col1", typeof(int)));            dt.Rows.Add(new object[] { 1 });            return dt;        }    }


前台代码:
JScript code
function btnClick(){    Service1.GetData(HandleStateChange,err);}        function HandleStateChange(result){    alert(result);    assa}function err(result){    alert("Error:" + result._message );}


一点击就报错:A circular reference was detected while serializing an object of type 'System.Reflection.Module'

但是直接进入asmx,调试,没有问题,难道说ASP.Net2.0没有解决DataTable在js上的序列化问题吗?


------解决方案--------------------
up
------解决方案--------------------
http://www.cnblogs.com/yinix/articles/767311.html
  相关解决方案
本站暂不开放注册!
内测阶段只得通过邀请码进行注册!