VS2012 + .net 4.0 + WebService + Jquery 1.9.1 + ajax亲测不坑爹例子

这个测试内容比较复杂,按照以下步骤去做,对于老手来说,可能也需要半个小时左右。有任何问题,请加QQ群讨论:23152359

最终效果图:

 

步骤:

1.建立项目。

    文件 -> 新建 -> 项目 -> 模板/Visual C#/Web/ASP.Net 空Web 应用程序,我用的是.net 4.0,在.net 4.5应该也一样。假设工程名字为 WebApplication3

2.增加WebService

    解决方案资源管理器 -> 鼠标左键单击选中 WebApplication3 -> 对WebApplication3单击鼠标右键,在弹出的菜单中选择:添加 -> 新建项 -> Visual C#/Web/Web 服务 ,名称填 WebService1.asmx(默认就是这个名字) -> 添加

3.修改WebService1.asmx

    上一步,添加后,会自动打开 WebService1.asmx.cs 

    3.1 看到这两行没?

// 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务,请取消注释以下行。 
// [System.Web.Script.Services.ScriptService]

        把 [System.Web.Script.Services.ScriptService] 前面的注释删掉。

    3.2 把WebService1.asmx.cs,修改为:

  1 using System;
  2 using System.Collections.Generic;
  3 using System.Linq;
  4 using System.Web;
  5 using System.Web.Services;
  6 using System.Diagnostics;
  7 
  8 namespace WebApplication3
  9 {
 10     /// <summary>
 11     /// WebService1 的摘要说明
 12     /// </summary>
 13     [WebService(Namespace = "http://tempuri.org/")]
 14     [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
 15     [System.ComponentModel.ToolboxItem(false)]
 16     // 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务,请取消注释以下行。 
 17     [System.Web.Script.Services.ScriptService]
 18     public class WebService1 : System.Web.Services.WebService
 19     {
 20 
 21         [WebMethod]
 22         public string HelloWorld()//不管这个
 23         {
 24             return "Hello World";
 25         }
 26 
 27         [WebMethod]
 28         public void Test1_NoArg_NoReturn()//测试1:无参数,无返回
 29         {
 30             Debugger.Log(0, "", "Test1_NoArg_NoReturn被调用!!\r\n");//记得在调试时,打开输出面板,才能看到这句话。打开方法:在调试时,菜单 -> 视图 -> 输出
 31             return;
 32         }
 33 
 34         [WebMethod]
 35         public int Test2_NoArg_ReturnS1()//测试2:无参数,有返回(简单类型_单个)
 36         {
 37             return ((new Random()).Next());
 38         }
 39 
 40         [WebMethod]
 41         public int[] Test3_ArgS1_ReturnSN(int arg_firstNumber)//测试3:有参数(简单类型_单个),有返回(简单类型_多个)
 42         {
 43             int[] intArray = new int[] { arg_firstNumber, (new Random()).Next(), (new Random()).Next(), (new Random()).Next(), (new Random()).Next() };
 44             return intArray;
 45         }
 46 
 47         [WebMethod]
 48         public Class_C Test4_ArgSN_ReturnC1(int[] arg_intValueArray)//测试4:有参数(简单类型_多个),有返回(复杂类型_单个)
 49         {
 50             Class_C result = new Class_C();
 51             result.ID = arg_intValueArray.Length;
 52             result.Name = "参数数量:" + result.ID.ToString() + "";
 53             result.IntArray = new int[arg_intValueArray.Length];
 54             result.StringArray = new string[arg_intValueArray.Length];
 55             for (int i = 0; i < arg_intValueArray.Length; i++)
 56             {
 57                 result.IntArray[i] = arg_intValueArray[i];
 58                 result.StringArray[i] = "StringMode:" + arg_intValueArray[i].ToString();
 59             }
 60             return result;
 61         }
 62 
 63         [WebMethod]
 64         public Class_C[] Test5_ArgC1_ReturnCN(Class_C arg_value)//测试5:有参数(复杂类型_单个), 有返回(复杂类型_多个)
 65         {
 66             Class_C[] resultArray = new Class_C[arg_value.IntArray.Length];
 67             for (int i = 0; i < arg_value.IntArray.Length; i++)
 68             {
 69                 resultArray[i] = new Class_C();
 70                 resultArray[i].ID = i + 1;
 71                 resultArray[i].Name = "ID : " + resultArray[i].ID;
 72                 resultArray[i].IntArray = new int[]{1,2,3,4,5};
 73                 resultArray[i].StringArray = new string[]{"1", "2", "3", "4", "5"};
 74             }
 75             return resultArray;
 76         }
 77 
 78         [WebMethod]
 79         public Class_X Test6_ArgCN_ReturnX1(Class_C[] arg_array)//测试6:有参数(复杂类型_多个), 有返回(复合类型_单个)
 80         {
 81             Class_X result = new Class_X();
 82             result.ID = arg_array.Length;
 83             result.Name = "Name : " + result.ID.ToString();
 84             int[] intArray = new int[arg_array.Length];
 85             string[] stringArray = new string[arg_array.Length];
 86             for (int i = 0; i < arg_array.Length; i++)
 87             {
 88                 intArray[i] = arg_array[i].ID;
 89                 stringArray[i] = arg_array[i].Name;
 90             }
 91             result.IntArray = intArray;
 92             result.StringArray = stringArray;
 93             result.Data = new Class_C();
 94             result.Data.ID = result.ID + 1;
 95             result.Data.Name = "Result.Data : " + result.Data.ID.ToString();
 96             result.Data.IntArray = result.IntArray.Clone() as int[];
 97             result.Data.StringArray = result.StringArray.Clone() as string[];
 98             return result;
 99         }
100 
101         [WebMethod]
102         public Class_X[] Test7_ArgX1_ReturnXN(Class_X arg_value)//测试7:有参数(复合类型_单个), 有返回(复合类型_多个)
103         {
104             Class_X[] resultArray = new Class_X[arg_value.ID];
105             for (int i = 0; i < resultArray.Length; i++)
106             {
107                 resultArray[i] = new Class_X();
108                 resultArray[i].ID = i + 1;
109                 resultArray[i].Name = "Name : " + resultArray[i].ID.ToString();
110                 int[] intArray = new int[arg_value.ID];
111                 string[] stringArray = new string[arg_value.ID];
112                 for (int j = 0; j < arg_value.ID; j++)
113                 {
114                     intArray[j] = j + 1;
115                     stringArray[j] = "ArrayMode : " + intArray[j].ToString();
116                 }
117                 resultArray[i].IntArray = intArray;
118                 resultArray[i].StringArray = stringArray;
119                 resultArray[i].Data = new Class_C();
120                 resultArray[i].Data.ID = resultArray[i].ID + 1;
121                 resultArray[i].Data.Name = "Result.Data : " + resultArray[i].Data.ID.ToString();
122                 resultArray[i].Data.IntArray = resultArray[i].IntArray.Clone() as int[];
123                 resultArray[i].Data.StringArray = resultArray[i].StringArray.Clone() as string[];
124             }
125             return resultArray;
126         }
127 
128         [WebMethod]
129         public void Test8_ArgXN_NoReturn(Class_X[] arg_array)//测试8:有参数(复合类型_多个),无返回
130         {
131             Debugger.Log(0, "", "Test8_ArgXN_NoReturn:arg_array.Length = " + arg_array.Length.ToString() + "\r\n");
132         }
133 
134         [WebMethod]
135         public void Test9_ArgMixAll_NoReturn(int arg_intValue, string arg_stringValue, Class_C arg_C1Value, Class_C[] arg_CNValue, Class_X arg_X1Value, Class_X[] arg_XNValue)//测试9:有参数(多个不同类型的参数),无返回
136         {
137             Debugger.Log(0, "", "Test9_ArgMixAll_NoReturn:Use Breakpoint\r\n");
138         }
139     }
140 
141     [Serializable]
142     public class Class_C
143     {
144         public int ID { get; set; }
145         public string Name { get; set; }
146         public int[] IntArray { get; set; }
147         public string[] StringArray { get; set; }
148     }
149 
150     [Serializable]
151     public class Class_X
152     {
153         public int ID { get; set; }
154         public string Name { get; set; }
155         public Class_C Data { get; set; }
156         public int[] IntArray { get; set; }
157         public string[] StringArray { get; set; }
158     }
159 }

 

 

4.去jquery官网,下载jquery-1.9.1.min.js,然后拖动到解决方案资源管理器的WebApplication3的目录下。拖动后,jquery-1.9.1.min.js应该与Web.config、WebService1.asmx在同一层次。

5.增加测试用网页

    解决方案资源管理器 -> 鼠标左键单击选中 WebApplication3 -> 对WebApplication3单击鼠标右键,在弹出的菜单中选择:添加 -> 新建项 -> Visual C#/Web/HTML 页 ,名称填 HtmlPage1.html(默认就是这个名字) -> 添加

    然后把HtmlPage1.html的内容,修改为:

 1 <!DOCTYPE html>
 2 <html xmlns="http://www.w3.org/1999/xhtml">
 3 <head>
 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
 5     <title></title>
 6     <style type="text/css">
 7         #WebUI_Output {
 8             height: 410px;
 9             width: 1050px;
10         }
11     </style>
12     <script type="text/javascript" src="jquery-1.9.1.min.js"></script>
13     <script type="text/javascript" src="JavaScript.js"></script>
14 </head>
15 <body>
16     <div>
17         <textarea id="WebUI_Output"></textarea>
18         <br />
19         <input type="button" value="Test1_NoArg_NoReturn" onclick="Event__Test1_NoArg_NoReturn()"/>
20         <br />
21         <input type="button" value="Test2_NoArg_ReturnS1" onclick="Event__Test2_NoArg_ReturnS1()"/>
22         <br />
23         <input type="button" value="Test3_ArgS1_ReturnSN" onclick="Event__Test3_ArgS1_ReturnSN()"/>
24         <br />
25         <input type="button" value="Test4_ArgSN_ReturnC1" onclick="Event__Test4_ArgSN_ReturnC1()"/>
26         <br />
27         <input type="button" value="Test5_ArgC1_ReturnCN" onclick="Event__Test5_ArgC1_ReturnCN()"/>
28         <br />
29         <input type="button" value="Test6_ArgCN_ReturnX1" onclick="Event__Test6_ArgCN_ReturnX1()"/>
30         <br />
31         <input type="button" value="Test7_ArgX1_ReturnXN" onclick="Event__Test7_ArgX1_ReturnXN()"/>
32         <br />
33         <input type="button" value="Test8_ArgXN_NoReturn" onclick="Event__Test8_ArgXN_NoReturn()"/>
34         <br />
35         <input type="button" value="Test9_ArgMixAll_NoReturn" onclick="Event__Test9_ArgMixAll_NoReturn()"/>
36     </div>
37 </body>
38 </html>

 

    最后,在解决方案资源管理器里,对 HtmlPage1.html 单击鼠标右键,选“设为起始页”。

 

6.增加测试用JS文件

    解决方案资源管理器 -> 鼠标左键单击选中 WebApplication3 -> 对WebApplication3单击鼠标右键,在弹出的菜单中选择:添加 -> 新建项 -> Visual C#/Web/JavaScript 文件 ,名称填 JavaScript.js -> 添加

    然后把JavaScript.js的内容,修改为:

  1 var Global_Config_URL = "/WebService1.asmx/";
  2 var Global_Counter = 0;
  3 
  4 function Output( arg_msg )
  5 {
  6     arg_msg = arg_msg.replace(/\\r\\n/g, "\r\n");
  7     Global_Counter++;
  8     $("#WebUI_Output").text("【" + Global_Counter.toString() + "】 " + arg_msg);
  9 }
 10 
 11 function OutputError(arg_errorMsg)
 12 {
 13     Output("遇到错误:" + arg_errorMsg);
 14 }
 15 
 16 function Event__Test1_NoArg_NoReturn()
 17 {
 18     var actionName = "Test1_NoArg_NoReturn";
 19     var options =
 20     {
 21         type: "POST",
 22         url: Global_Config_URL + actionName,
 23         contentType: "application/json; charset=utf-8",
 24         error: function (jqXHR, errorType, errorMsg)
 25         {
 26             OutputError(errorMsg + ",详细信息:" + jqXHR.responseText);
 27         },
 28         success: function (result, textArgs, jqXHRArg)
 29         {
 30             Output("调用成功");
 31         }
 32     }
 33     $.ajax(options)
 34 }
 35 
 36 function Event__Test2_NoArg_ReturnS1()
 37 {
 38     var actionName = "Test2_NoArg_ReturnS1";
 39     var options =
 40     {
 41         type: "POST",
 42         url: Global_Config_URL + actionName,
 43         contentType: "application/json; charset=utf-8",
 44         error: function (jqXHR, errorType, errorMsg)
 45         {
 46             OutputError(errorMsg + ",详细信息:" + jqXHR.responseText);
 47         },
 48         success: function (result, textArgs, jqXHRArg)
 49         {
 50             Output("返回随机Int值:" + result.d);
 51         }
 52     }
 53     $.ajax(options)
 54 }
 55 
 56 function Event__Test3_ArgS1_ReturnSN()
 57 {
 58     var actionName = "Test3_ArgS1_ReturnSN";
 59     var arg_firstNumber = parseInt(Math.random() * 2100000000);
 60     var arg_dataMode = "{ arg_firstNumber: " + arg_firstNumber.toString() + " }";
 61     var options =
 62     {
 63         type: "POST",
 64         url: Global_Config_URL + actionName,
 65         contentType: "application/json; charset=utf-8",
 66         dataType: "json",
 67         data: arg_dataMode,
 68         error: function (jqXHR, errorType, errorMsg)
 69         {
 70             OutputError(errorMsg + ",详细信息:" + jqXHR.responseText);
 71         },
 72         success: function (result, textArgs, jqXHRArg)
 73         {
 74             Output("返回Int随机数组:" + result.d);
 75         }
 76     }
 77     $.ajax(options)
 78 }
 79 
 80 function Event__Test4_ArgSN_ReturnC1()
 81 {
 82     var actionName = "Test4_ArgSN_ReturnC1";
 83     var arg_randomNumberArray = [];
 84     var arg_randomNumberArray_Length = 5;
 85     for (var i = 0; i < arg_randomNumberArray_Length; i++)
 86     {
 87         
 88         arg_randomNumberArray.push(parseInt(Math.random() * 2100000000));
 89     }
 90     var arg_dataMode = "";
 91     for (var i = 0; i < arg_randomNumberArray_Length; i++) 
 92     {
 93         if( i == 0 )
 94         {
 95             arg_dataMode += "{ arg_intValueArray : [ ";
 96         }
 97         arg_dataMode += arg_randomNumberArray[i].toString();
 98         if ( i != arg_randomNumberArray_Length - 1 ) 
 99         {
100             arg_dataMode += ", ";
101         }
102         else
103         {
104             arg_dataMode += " ] }";
105         }
106     }
107     var options =
108     {
109         type: "POST",
110         url: Global_Config_URL + actionName,
111         contentType: "application/json; charset=utf-8",
112         dataType: "json",
113         data: arg_dataMode,
114         error: function (jqXHR, errorType, errorMsg)
115         {
116             OutputError(errorMsg + ",详细信息:" + jqXHR.responseText);
117         },
118         success: function (result, textArgs, jqXHRArg)
119         {
120             var debugMode_Result = result.d;//在这里下断点,来查看返回值。
121             Output("返回Class_C:具体数据请在JavaScript.js里通过Debug查看。");
122         }
123     }
124     $.ajax(options)
125 }
126 
127 function Event__Test5_ArgC1_ReturnCN()
128 {
129     var actionName = "Test5_ArgC1_ReturnCN";
130     var arg_dataMode = "{ arg_value : { ID : 199, Name : 'Name 199', IntArray : [ 2, 4, 8, 256, 1024 ], StringArray : [ 'StringMode:2', 'StringMode:4', 'StringMode:8', 'StringMode:256', 'StringMode:1024' ] } }";
131     var options =
132     {
133         type: "POST",
134         url: Global_Config_URL + actionName,
135         contentType: "application/json; charset=utf-8",
136         dataType: "json",
137         data: arg_dataMode,
138         error: function (jqXHR, errorType, errorMsg)
139         {
140             OutputError(errorMsg + ",详细信息:" + jqXHR.responseText);
141         },
142         success: function (result, textArgs, jqXHRArg)
143         {
144             var debugMode_Result = result.d;//在这里下断点,来查看返回值。
145             Output("返回Class_C[]:具体数据请在JavaScript.js里通过Debug查看。");
146         }
147     }
148     $.ajax(options)
149 }
150 
151 function Event__Test6_ArgCN_ReturnX1()
152 {
153     var actionName = "Test6_ArgCN_ReturnX1";
154     var arg_dataMode = "";
155     var arg_arrayLength = 5;
156     for (var i = 0; i < arg_arrayLength; i++)
157     {
158         if (i == 0)
159         {
160             arg_dataMode += "{ arg_array : [ ";
161         }
162         var currentDataMode = "{ ID : " + (i+1).toString() + ", Name : 'Name " + (i+1).toString() + "', IntArray : [ 2, 4, 8, 256, 1024 ], StringArray : [ 'StringMode:2', 'StringMode:4', 'StringMode:8', 'StringMode:256', 'StringMode:1024' ] }";
163         arg_dataMode += currentDataMode;
164         if (i != arg_arrayLength - 1)
165         {
166             arg_dataMode += ", ";
167         }
168         else
169         {
170             arg_dataMode += " ] }";
171         }
172     }
173     var options =
174     {
175         type: "POST",
176         url: Global_Config_URL + actionName,
177         contentType: "application/json; charset=utf-8",
178         dataType: "json",
179         data: arg_dataMode,
180         error: function (jqXHR, errorType, errorMsg)
181         {
182             OutputError(errorMsg + ",详细信息:" + jqXHR.responseText);
183         },
184         success: function (result, textArgs, jqXHRArg)
185         {
186             var debugMode_Result = result.d;//在这里下断点,来查看返回值。
187             Output("返回Class_X:具体数据请在JavaScript.js里通过Debug查看。");
188         }
189     }
190     $.ajax(options)
191 }
192 
193 function Event__Test7_ArgX1_ReturnXN()
194 {
195     var actionName = "Test7_ArgX1_ReturnXN";
196     var arg_dataMode = "{ arg_value : { ID : 399, Name : 'Name : 399', IntArray : [ 2, 4, 8, 128, 256 ], StringArray : [ 'StringMode:2', 'StringMode:4', 'StringMode:8', 'StringMode:128', 'StringMode:256' ] } }";
197     var options =
198     {
199         type: "POST",
200         url: Global_Config_URL + actionName,
201         contentType: "application/json; charset=utf-8",
202         dataType: "json",
203         data: arg_dataMode,
204         error: function (jqXHR, errorType, errorMsg)
205         {
206             OutputError(errorMsg + ",详细信息:" + jqXHR.responseText);
207         },
208         success: function (result, textArgs, jqXHRArg)
209         {
210             var debugMode_Result = result.d;//在这里下断点,来查看返回值。
211             Output("返回Class_X[]:具体数据请在JavaScript.js里通过Debug查看。");
212         }
213     }
214     $.ajax(options)
215 }
216 
217 function Event__Test8_ArgXN_NoReturn()
218 {
219     var actionName = "Test8_ArgXN_NoReturn";
220     var arg_dataMode = "";
221     var arg_arrayLength = 5;
222     for (var i = 0; i < arg_arrayLength; i++)
223     {
224         if (i == 0)
225         {
226             arg_dataMode += "{ arg_array : [ ";
227         }
228         var currentDataMode = "{ ID: " + (i + 1).toString() + ", Name: 'Name : " + (i + 1).toString() + "', IntArray: [2, 4, 8, 128, 256], StringArray: ['StringMode:2', 'StringMode:4', 'StringMode:8', 'StringMode:128', 'StringMode:256'] }";
229         arg_dataMode += currentDataMode;
230         if (i != arg_arrayLength - 1)
231         {
232             arg_dataMode += ", ";
233         }
234         else
235         {
236             arg_dataMode += " ] }";
237         }
238     }
239     var options =
240     {
241         type: "POST",
242         url: Global_Config_URL + actionName,
243         contentType: "application/json; charset=utf-8",
244         dataType: "json",
245         data: arg_dataMode,
246         error: function (jqXHR, errorType, errorMsg)
247         {
248             OutputError(errorMsg + ",详细信息:" + jqXHR.responseText);
249         },
250         success: function (result, textArgs, jqXHRArg)
251         {
252             Output("调用成功");
253         }
254     }
255     $.ajax(options)
256 }
257 
258 function Event__Test9_ArgMixAll_NoReturn()
259 {
260     var actionName = "Test9_ArgMixAll_NoReturn";
261     var arg_dataMode = "";
262     //1.arg: intValue
263     var arg_intValue = "arg_intValue : 12345";
264     //2.arg: stringValue
265     var arg_stringValue = "arg_stringValue : 'StringMode:12345'";
266     //3.arg: Class_C C1Value
267     var arg_C1Value = "arg_C1Value : { ID : 900, Name : 'Name : 900', IntArray : [ 1, 2, 3, 4, 5 ], StringArray : [ 'StringMode:1', 'StringMode:2', 'StringMode:3', 'StringMode:4', 'StringMode:5' ] }";
268     //4.arg: Class_C[] CNValue
269     var arg_CNValue = "";
270     var arg_CNValueLength = 5;
271     for (var i = 0; i < arg_CNValueLength; i++)
272     {
273         if (i == 0)
274         {
275             arg_CNValue += "arg_CNValue : [ ";
276         }
277         var currentC1Value = "{ ID : " + (i + 1).toString() + ", Name : 'Name : " + (i + 1).toString() + "', IntArray : [ 4, 5, 6, 7, 8 ], StringArray : [ 'StringMode:4', 'StringMode:5', 'StringMode:6', 'StringMode:7', 'StringMode:8' ] }";
278         arg_CNValue += currentC1Value;
279         if (i != arg_CNValueLength - 1)
280         {
281             arg_CNValue += ", ";
282         }
283         else
284         {
285             arg_CNValue += " ]";
286         }
287     }
288     //5.arg: Class_X X1Value
289     var arg_X1Value = "arg_X1Value : { ID : 399, Name : 'Name : 399', IntArray : [ 2, 4, 8, 128, 256 ], StringArray : [ 'StringMode:2', 'StringMode:4', 'StringMode:8', 'StringMode:128', 'StringMode:256' ] }";
290     //6.arg: Class_X[] XNValue
291     var arg_XNValue = "";
292     var arg_XNValueLength = 5;
293     for (var i = 0; i < arg_XNValueLength; i++)
294     {
295         if (i == 0)
296         {
297             arg_XNValue += "arg_XNValue : [ ";
298         }
299         var currentX1Value = "{ ID: " + (i + 1).toString() + ", Name: 'Name : " + (i + 1).toString() + "', IntArray: [2, 4, 8, 128, 256], StringArray: ['StringMode:2', 'StringMode:4', 'StringMode:8', 'StringMode:128', 'StringMode:256'] }";
300         arg_XNValue += currentX1Value;
301         if (i != arg_XNValueLength - 1)
302         {
303             arg_XNValue += ", ";
304         }
305         else
306         {
307             arg_XNValue += " ]";
308         }
309     }
310     //Mix ALL
311     arg_dataMode += "{ " + arg_intValue + ", " + arg_stringValue + ", " + arg_C1Value + ", " + arg_CNValue + ", " + arg_X1Value + ", " + arg_XNValue + " }";
312     var options =
313     {
314         type: "POST",
315         url: Global_Config_URL + actionName,
316         contentType: "application/json; charset=utf-8",
317         dataType: "json",
318         data: arg_dataMode,
319         error: function (jqXHR, errorType, errorMsg)
320         {
321             OutputError(errorMsg + ",详细信息:" + jqXHR.responseText);
322         },
323         success: function (result, textArgs, jqXHRArg)
324         {
325             Output("调用成功");
326         }
327     }
328     $.ajax(options)
329 }

 

 

7.修改Web配置文件

    由于测试方法中,有部分方法,从服务端返回到客户端的数据量比较大,因此需要修改一下默认Web配置文件,否则会报错说超过最大长度。

    解决方案资源管理器 -> 鼠标左键双击 Web.config,然后把Web.config的内容,修改为:

 1 <?xml version="1.0" encoding="utf-8"?>
 2 
 3 <!--
 4   有关如何配置 ASP.NET 应用程序的详细信息,请访问
 5   http://go.microsoft.com/fwlink/?LinkId=169433
 6   -->
 7 
 8 <configuration>
 9     <system.web>
10       <compilation debug="true" targetFramework="4.0" />
11     </system.web>
12     <system.web.extensions>
13         <scripting>
14             <webServices>
15                 <jsonSerialization maxJsonLength="2100000000" />
16             </webServices>
17         </scripting>
18     </system.web.extensions>
19 </configuration>

 

 

8.现在,就可以在VS2012里进行调试了。

    解决方案资源管理器 -> 鼠标左键单击选中 HtmlPage1.html,然后按F5开始调试。有些功能,需要在WebService1.asmx或JavaScript.js里的对应位置,下断点来查看数据信息,具体信息请看提示。

 

posted on 2013-05-23 16:18  xxxteam  阅读(1993)  评论(0编辑  收藏  举报

导航