- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Text;
- using System.Windows.Forms;
- using System.Runtime;
- using System.Runtime.Remoting;
- using System.Runtime.Remoting.Channels;
- using System.Runtime.Remoting.Channels.Http;
- namespace RemotingXPServer
- {
- public partial class Form1 : Form
- {
- HttpChannel http = new HttpChannel(10096);
- public Form1()
- {
- InitializeComponent();
- }
- private void btnStartServer_Click(object sender, EventArgs e)
- {
- ChannelServices.RegisterChannel(http, false);
- RemotingConfiguration.RegisterWellKnownServiceType(typeof(HelloRemoting.Hello), "Hi", WellKnownObjectMode.SingleCall);
- MessageBox.Show("服务已经打开,点击确定关闭服务");
- this.btnStartServer.Enabled = false;
- this.btnClose.Enabled = true;
- }
- private void btnClose_Click(object sender, EventArgs e)
- {
- ChannelServices.UnregisterChannel(http);
- this.btnStartServer.Enabled = true;
- this.btnClose.Enabled = false;
- }
- }
- }
Remoting服务器
最新推荐文章于 2021-05-27 10:08:32 发布