-
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;
-
namespace WindowsFormsApplication1
- {
-
public partial class Form1 : Form
- {
-
public Form1()
- {
- InitializeComponent();
- }
-
private void button1_Click(object sender, EventArgs e)
- {
-
localhost.Service t = new WindowsFormsApplication1.localhost.Service();
- MessageBox.Show(t.HelloWorld());
-
MessageBox.Show("Down!");
- }
-
private void button2_Click(object sender, EventArgs e)
- {
-
localhost.Service t = new WindowsFormsApplication1.localhost.Service();
-
t.HelloWorldCompleted += new WindowsFormsApplication1.localhost.HelloWorldCompletedEventHandler(t_HellowordCompleted);
- t.HelloWorldAsync();
-
MessageBox.Show("Down!");
- }
-
private void t_HellowordCompleted(object sender, localhost.HelloWorldCompletedEventArgs e)
- {
- MessageBox.Show(e.Result.ToString());
- }
-
private void button3_Click(object sender, EventArgs e)
- {
-
MessageBox.Show((new localhost.Service()).GetTime());
- }
- }
- }
- ---------------------webService----------------------------
-
using System;
-
using System.Linq;
-
using System.Web;
-
using System.Web.Services;
-
using System.Web.Services.Protocols;
-
using System.Xml.Linq;
-
using System.Threading;
-
[WebService(Namespace = "http://tempuri.org/")]
- [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
-
-
-
public class Service : System.Web.Services.WebService
- {
-
public Service () {
-
-
- }
- [WebMethod]
-
public string HelloWorld() {
- Thread.Sleep(3000);
-
return "Hello World";
- }
-
-
[WebMethod(false,System.EnterpriseServices.TransactionOption.NotSupported,10)]
-
public string GetTime()
- {
-
return DateTime.Now.ToString();
- }
-
- }
相关文章:
-
2022-12-23
-
2022-12-23
-
2022-03-06
-
2022-12-23
-
2021-11-15
-
2021-08-07
-
2021-12-06
猜你喜欢
-
2022-12-23
-
2022-12-23
-
2021-09-30
-
2021-09-12
-
2021-07-26
-
2021-07-23
相关资源
-
下载
2023-01-18
-
下载
2023-01-18
-
下载
2022-12-02