wcf客户端(测试服务端)

时间:2021-06-14 04:52:04
【文件属性】:
文件名称:wcf客户端(测试服务端)
文件大小:43KB
文件格式:ZIP
更新时间:2021-06-14 04:52:04
wcf 接口 这是为自己配置的一套集合测试用的, 里面有oracl、sql server的连接文件类,发送邮件类、 DES加密/解密类,信息截取过滤类、类型转换类、保存日志到文件中功能等 static void Main(string[] args) { PublicQuery qs = new PublicQuery(); Type service1 = typeof(WCFServices); using (ServiceHost host = new ServiceHost(service1)) { Console.WriteLine(); Console.WriteLine("后台WCF服务器 开始运行...."); Console.WriteLine(); string hostAddress = host.BaseAddresses[0].ToString(); Console.WriteLine("服务地址: " + hostAddress + "\r\n"); string temp = hostAddress.Substring(hostAddress.LastIndexOf(":") + 1); string hostPort = temp.Substring(0, temp.IndexOf("/")); //抬头修改 Console.Title = "系统启动,端口:" + hostPort; Console.WriteLine(); host.Open(); Console.WriteLine("按 ESC 即可开始结束程序运行!"); string strIsYes = ""; do { string strExit = Console.ReadLine(); while (strExit.ToLower() != "esc") { System.Threading.Thread.Sleep(1000); Console.WriteLine("按 ESC 即可开始结束程序运行!"); strExit = ""; strExit = Console.ReadLine(); } // Console.Write("确实退出 ? (y/n) "); strIsYes = Console.ReadLine(); } while (strIsYes.ToLower() != "y"); //关闭服务连接 if (host.State == CommunicationState.Opened) { host.Close(); System.Threading.Thread.Sleep(1000); } ---------------------------- app.config <baseAddresses> </baseAddresses>
【文件预览】:
test
----test.sln(902B)
----test.v11.suo(44KB)
----test()
--------Program.cs(984B)
--------Properties()
--------App.config(650B)
--------test.csproj(3KB)
--------obj()
--------bin()
--------RuralServices.cs(6KB)

网友评论