(三)c#整合zeroIce - iceBox

vs版本: vs2015
.net: 4.5.2
语言: c#
整合参考 :https://github.com/zeroc-ice/ice-demos (或安装icegrid,通过“Source Code on GitHub”指引找到)
下载IceBuilders for visualStudiohttps://zeroc.com/downloads/builders
整合后代码地址:http://download.csdn.net/download/yeness/10010388

1、Ice Builders for visual studio

  1. 双击安装IceBuilder.vsix
  2. 项目右键 -> Add Ice Builder To Project
  3. 项目右键 -> 属性 -> Ice Builder -> Referenced Assemblies: ->勾选 Ice、IceBox 、IceSSL
    这里写图片描述

2、Server端配置

*使用 iceBox,可通过配置文件启动,同时配置文件需将属性改为始终复制。
*同时复制demo中icebox/hello 下的iceboxnet.exe到项目

  • config.admin
#
# Proxy to the IceBox ServiceManager:
#
IceBoxAdmin.ServiceManager.Proxy=DemoIceBox/admin -f IceBox.ServiceManager:tcp -p 9996 -h localhost
  • config.icebox
#
# The IceBox ServiceManager object is provided as a facet of the Ice.Admin object.
#

#
# Enable Ice.Admin object:
#
Ice.Admin.Endpoints=tcp -p 9996 -h localhost
Ice.Admin.InstanceName=DemoIceBox

#
# The hello service
#
#IceBox.Service.Hello=helloservice.dll:HelloServiceI --Ice.Config=config.service
IceBox.Service.Printer=com.company.test.Server:PrinterServiceI --Ice.Config=config.service

#
# Warn about connection exceptions
#
Ice.Warn.Connections=1

#
# Network Tracing
#
# 0 = no network tracing
# 1 = trace connection establishment and closure
# 2 = like 1, but more detailed
# 3 = like 2, but also trace data transfer
#
#Ice.Trace.Network=1

#
# Protocol Tracing
#
# 0 = no protocol tracing
# 1 = trace protocol messages
#
#Ice.Trace.Protocol=1
  • config.service
#
# The server creates one single object adapter with the name of the
# service. The following line sets the endpoints for this adapter.
# 这里注释掉ssl
#Printer.Endpoints=tcp -p 10000 -h localhost:udp -p 10000 -h localhost:ssl -p 10001 -h localhost

Printer.Endpoints=tcp -p 10000 -h localhost

#
# Warn about connection exceptions
#
Ice.Warn.Connections=1

#
# Network Tracing
#
# 0 = no network tracing
# 1 = trace connection establishment and closure
# 2 = like 1, but more detailed
# 3 = like 2, but also trace data transfer
#
#Ice.Trace.Network=1

#
# Protocol Tracing
#
# 0 = no protocol tracing
# 1 = trace protocol messages
#
#Ice.Trace.Protocol=1

#
# SSL plug-in configuration
#
#Ice.Plugin.IceSSL="IceSSL,Version=3.7.0.0":IceSSL.PluginFactory
#IceSSL.DefaultDir=./certs
#IceSSL.CAs=cacert.pem
#IceSSL.CertFile=server.p12
#IceSSL.Password=password

3、Client端

config.client

#
# The client reads this property to create the reference to the
# "hello" object in the server.
#
#Printer.Proxy=hello:tcp -h localhost -p 10000:udp -h localhost -p 10000:ssl -h localhost -p 10001
Printer.Proxy=printer:tcp -p 10000 -h localhost
#
# Warn about connection exceptions
#
Ice.Warn.Connections=1

#
# Network Tracing
#
# 0 = no network tracing
# 1 = trace connection establishment and closure
# 2 = like 1, but more detailed
# 3 = like 2, but also trace data transfer
#
#Ice.Trace.Network=1

#
# Protocol Tracing
#
# 0 = no protocol tracing
# 1 = trace protocol messages
#
#Ice.Trace.Protocol=1

#
# SSL plug-in configuration
#
#Ice.Plugin.IceSSL=IceSSL:IceSSL.PluginFactory
#IceSSL.DefaultDir=../../../certs
#IceSSL.CAs=cacert.pem
#IceSSL.CertFile=client.p12
#IceSSL.Password=password

client -> Programs.cs

string strCmdText;
strCmdText = "/C iceboxnet --Ice.Config=config.icebox";
System.Diagnostics.Process.Start("CMD.exe", strCmdText);
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值