/-----------------webServices 代码-----------------------
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.Services;
///
/// Summary description for testService
///
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
// [System.Web.Script.Services.ScriptService]
public class testService : System.Web.Services.WebService {
public testService () {
//Uncomment the following line if using designed components
//InitializeComponent();
}
[WebMethod]
public string HelloWorld() {
return "Hello World";
}
}
已经发布到iis上
在项目中右键-》添加web 引用—》url输入:http://192.168.0.11/WebService/testService.asmx
(可以正常调用WebService,)设置引用名:WebReference,点击添加引用。
在窗口中添加了 lable 和 Button 代码如下
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace SmartDeviceProject1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}