cathome 猫家 开发日记-webservice服务 ,生成json.
发布时间:2020-12-16 21:38:28 所属栏目:安全 来源:网络整理
导读:概述,采用熟悉的c# 语言。 1.用asmx 。微软的web服务的标准格式。方便。 2.由方法生成json字符。只是利用ms 的框架而已。 ? 配置文档。 ?xml version= " 1.0 " encoding= " utf-8 " ?!-- 有关如何配置 ASP.NET 应用程序的详细信息,请访问 http: // go.micr
概述,采用熟悉的c# 语言。 1.用asmx 。微软的web服务的标准格式。方便。 2.由方法生成json字符。只是利用ms 的框架而已。 ? 配置文档。 <?xml version="1.0" encoding="utf-8"?> <!-- 有关如何配置 ASP.NET 应用程序的详细信息,请访问 http://go.microsoft.com/fwlink/?LinkId=169433 --> <configuration> <system.web> <compilation debug="true" targetFramework="4.5" /> <httpRuntime targetFramework="4.5" /> <webServices> <protocols> <add name="HttpPost"/> <add name="HttpGet"/> </protocols> </webServices> </system.web> <connectionStrings> <add name="dbstr" connectionString="Data Source=localhost;Initial Catalog=mycity;User ID=sa;Password="/> </connectionStrings> </configuration> ? ? 方法 /// <summary> /// WebService1 的摘要说明 /// </summary> [WebService(Namespace="mycity")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [System.ComponentModel.ToolboxItem(false)] [System.Web.Script.Services.ScriptService] public class MainPage : System.Web.Services.WebService { //商家的大类 [WebMethod(Description = "商家的大类")] public void Category_MainCategory() { List<Model.VCategory_All> category = bll_category.GetModelList("cg_fatherid=‘0‘"); string jasonCategory = Function.ConvertJson.ListToJson(category); Context.Response.Write(jasonCategory); Context.Response.End(); } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |