53 lines
1.5 KiB
C#
53 lines
1.5 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.ComponentModel;
|
|||
|
using System.Data;
|
|||
|
using System.Drawing;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Windows.Forms;
|
|||
|
using System.ServiceModel;
|
|||
|
namespace DeiNiu.wcfApp
|
|||
|
{
|
|||
|
public partial class Form1 : Form
|
|||
|
{
|
|||
|
public Form1()
|
|||
|
{
|
|||
|
InitializeComponent();
|
|||
|
}
|
|||
|
ServiceHost host = null;//定义 ServiceHost
|
|||
|
private void button1_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
// host = new ServiceHost(typeof(DeiNiu .Wcf.WmsOutPickRequestService));//WcfDemo.Service1 为引用的dll中的服务
|
|||
|
// host = new ServiceHost(typeof(WcfService1.Service1));
|
|||
|
// host.Open();//启动服务
|
|||
|
// this.label1.Text = "服务已启动";
|
|||
|
}
|
|||
|
|
|||
|
private void button2_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (host.State != CommunicationState.Closed)//判断服务是否关闭
|
|||
|
{
|
|||
|
host.Close();//关闭服务
|
|||
|
}
|
|||
|
this.label1.Text = "服务已关闭";
|
|||
|
}
|
|||
|
|
|||
|
private void button3_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
// WcfService2.Service1 client = new WcfService2.Service1();
|
|||
|
|
|||
|
// client.lightTables(1, 10, null, null, null);
|
|||
|
|
|||
|
/*
|
|||
|
ServiceReference1.Service1Client client = new ServiceReference1.Service1Client();
|
|||
|
|
|||
|
client.lightTables(1, 10, null, null, null);
|
|||
|
|
|||
|
client.Close();
|
|||
|
* */
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
}
|