创建了一个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