vs2013
生成的时候
去电脑启动服务
当调用webfrom中的ashx相应的接口时,返回的格式和webapi不一样(很坑,从net core 3.1 webapi现在又来搞webform了)
public void GetPictureMaterialUrl(HttpContext context) { var query = "select url from PictureMaterial"; var result = DB.DataSet(ConnectionString, query); List<string> list = new List<string>(); if (result.Tables.Count > 0 && result.Tables[0].Rows.Count > 0) { for (int i = 0; i < result.Tables[0].Rows.Count; i++) { var item = result.Tables[0].Rows[i][0].ToString(); if (!string.IsNullOrEmpty(item)) { list.Add(item); } } } context.Response.ContentType = "application/json"; context.Response.ContentEncoding = Encoding.UTF8; context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(list)); context.Response.End(); }