小白跪求个webservice的易懂的例子 从java转到C#,白丁一名,目前的项目要求用webservice,求个webservice速度能懂的例子,最好有注释。有好的视频教程地址链接也ok! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 这个你绝对看得懂http://www.cnblogs.com/denylau/archive/2010/07/23/1783530.html 使用C#创建webservice及三种调用方式。 博客猿里artech写的文章很不错.http://www.cnblogs.com/artech/ http://www.cnblogs.com/qidian10/archive/2011/08/05/2128199.html不管是 ashx 还是 aspx 还是什么 都只是一个访问的地址和类型而已最主要的数据的访问协议 交互方式。所以aspx后台的方法怎么写,接口的代码就怎么写最主要的就是你需要确定你的数据格式 例如是XML? JSON? bytes? 首先是webservice的代码------------------------------------------------------using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.Services;using System.Configuration;/// <summary>///Serviceset 的摘要说明/// </summary>[WebService(Namespace = "http://tempuri.org/")][WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]//若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务,请取消对下行的注释。 // [System.Web.Script.Services.ScriptService]public class Serviceset : System.Web.Services.WebService { public Serviceset () { //如果使用设计的组件,请取消注释以下行 //InitializeComponent(); } [WebMethod] #region 获取数据库连接 /// <summary> /// 获取数据库连接 /// </summary> /// <returns></returns> public string getdbConnection() { return ConfigurationManager.AppSettings["dbConnection"]; } #endregion}---------------------------------------------------------------------然后是使用的代码---------------------------------------------------------------------string serviceurl = "http://" + Properties.Settings.Default.server + ":" + Properties.Settings.Default.port + "/Serviceset.asmx";Properties.Settings.Default.serverConn = server.InvokeWebService(serviceurl, "getdbConnection",null).ToString(); 给你个 我收藏的。博客园的 有代码和图例http://www.cnblogs.com/wanghui9072229/archive/2011/03/17/1987371.html 不用跪求,直接问就好了。视频是能去webcast里找了,非常的全。 一个很不错的WinForm Word嵌入式控件 代码红色部分的第一个ReadLine()为什么不执行那? 关于datagridview中处理xml Button的Enabled设为false之后,怎么响应事件? WPF,如何取得当前窗口大小和位置 超智能字符分割 txt文本读出后二进制的问题 ◆◆◆如何在关机前对另一个程序进行操作◆◆◆ 简单设置文件属性和判断文件夹是否存在问题请教! 程序崩溃,异常代码0xc0000005,急,在线等! Dispose 的影响力 exe文件为什么不能运行
http://www.cnblogs.com/denylau/archive/2010/07/23/1783530.html
使用C#创建webservice及三种调用方式。
http://www.cnblogs.com/artech/
都只是一个访问的地址和类型而已最主要的数据的访问协议 交互方式。所以aspx后台的方法怎么写,接口的代码就怎么写
最主要的就是你需要确定你的数据格式 例如是XML? JSON? bytes?
------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Configuration;/// <summary>
///Serviceset 的摘要说明
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
//若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务,请取消对下行的注释。
// [System.Web.Script.Services.ScriptService]
public class Serviceset : System.Web.Services.WebService { public Serviceset () { //如果使用设计的组件,请取消注释以下行
//InitializeComponent();
}
[WebMethod]
#region 获取数据库连接
/// <summary>
/// 获取数据库连接
/// </summary>
/// <returns></returns>
public string getdbConnection()
{
return ConfigurationManager.AppSettings["dbConnection"];
}
#endregion
}
---------------------------------------------------------------------
然后是使用的代码
---------------------------------------------------------------------
string serviceurl = "http://" + Properties.Settings.Default.server + ":" + Properties.Settings.Default.port + "/Serviceset.asmx";
Properties.Settings.Default.serverConn = server.InvokeWebService(serviceurl, "getdbConnection",null).ToString();
http://www.cnblogs.com/wanghui9072229/archive/2011/03/17/1987371.html
视频是能去webcast里找了,非常的全。