使用 Zeroc 中的 ICE,如何在 .NET 中配置 Icebox 来托管两个独立的服务?

发布于 2024-10-19 16:33:25 字数 337 浏览 7 评论 0原文

使用 ICE 我可以使用以下命令启动单个服务器:(

iceboxnet.exe --Ice.Config=config.icebox

下载 ICE v3.4.1 演示源 并查看目录“Ice-3.4.1-demos\democs\IceGrid\simple”)

问题:我该如何做在同一个冰箱中启动两个服务器,每个服务器都包含在单独的 .dll 文件中?

Using ICE I can start a single server using the following command:

iceboxnet.exe --Ice.Config=config.icebox

(download the ICE v3.4.1 demo source and look at directory "Ice-3.4.1-demos\democs\IceGrid\simple")

Question: How do I start two servers within the same icebox, with each server contained in a separate .dll file?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

飘落散花 2024-10-26 16:33:25

密钥位于用户手册的“43.3.4:配置服务”下:

属性的名称部分是服务名称(IceStorm,在此
例子)。该名称将传递给服务的启动操作,并且在服务中必须是唯一的
所有服务都配置在同一个 Icebox 服务器中。

因此,您需要为每个服务使用不同的接口名称(这很有意义:每个服务需要一个唯一的名称)。我们需要复制接口“hello”,并将其命名为“hello2”。

在 config.icebox 中添加额外的一行:

 # The hello service (2 identical copies)
 IceBox.Service.Hello=helloservice.dll:HelloServiceI --Ice.Config=config.service
 IceBox.Service.Hello2=helloservice2.dll:Hello2ServiceI --Ice.Config=config2.service

创建 config.service 的副本,将其命名为 config2.service,并更改名称和端口:

Hello.Endpoints=tcp -p 10000:udp -p 10000:ssl -p 10001

... 编辑为:

Hello2.Endpoints=tcp -p 20000:udp -p 20000:ssl -p 20001

现在,我们需要编译新版本的“helloservice”。 dll”,它使用“hello2”作为接口。遍历C#项目,将所有“hello”重命名为“hello2”,将编译输出从“helloservice.dll”重命名为“helloservice2.dll”。

现在,这两个服务将在同一个冰箱下启动,如果您通过更改 .config 文件来打开登录:

 C:\Program Files (x86)\ZeroC\Ice-3.4.1\Ice-3.4.1-demos\democs\IceBox\hello>iceboxnet.exe --Ice.Config=config.icebox
 -- 3/2/2011 15:10:32:316 iceboxnet.exe-Hello: Network: attempting to bind to tcp socket 0.0.0.0:10000
 -- 3/2/2011 15:10:32:373 iceboxnet.exe-Hello: Network: accepting tcp connections at 0.0.0.0:10000
    local interfaces: 192.168.1.10, 127.0.0.1
 -- 3/2/2011 15:10:32:382 iceboxnet.exe-Hello: Network: attempting to bind to udp socket 0.0.0.0:10000
 -- 3/2/2011 15:10:32:429 iceboxnet.exe-Hello: Network: starting to receive udp packets
    local address = 0.0.0.0:10000
    local interfaces: 192.168.1.10, 127.0.0.1
 -- 3/2/2011 15:10:32:457 iceboxnet.exe-Hello: Network: attempting to bind to ssl socket 0.0.0.0:10001
 -- 3/2/2011 15:10:32:507 iceboxnet.exe-Hello: Network: accepting ssl connections at 0.0.0.0:10001
    local interfaces: 192.168.1.10, 127.0.0.1
 -- 3/2/2011 15:10:32:649 iceboxnet.exe-Hello: Network: published endpoints for object adapter `Hello':
    tcp -h 192.168.1.10 -p 10000:udp -h 192.168.1.10 -p 10000:ssl -h 192.168.1.10 -p 10001
 -- 3/2/2011 15:10:32:745 iceboxnet.exe-Hello2: Network: attempting to bind to tcp socket 0.0.0.0:20000
 -- 3/2/2011 15:10:32:794 iceboxnet.exe-Hello2: Network: accepting tcp connections at 0.0.0.0:20000
    local interfaces: 192.168.1.10, 127.0.0.1
 -- 3/2/2011 15:10:32:795 iceboxnet.exe-Hello2: Network: attempting to bind to udp socket 0.0.0.0:20000
 -- 3/2/2011 15:10:32:839 iceboxnet.exe-Hello2: Network: starting to receive udp packets
    local address = 0.0.0.0:20000
    local interfaces: 192.168.1.10, 127.0.0.1
 -- 3/2/2011 15:10:32:840 iceboxnet.exe-Hello2: Network: attempting to bind to ssl socket 0.0.0.0:20001
 -- 3/2/2011 15:10:32:885 iceboxnet.exe-Hello2: Network: accepting ssl connections at 0.0.0.0:20001
    local interfaces: 192.168.1.10, 127.0.0.1
 -- 3/2/2011 15:10:33:021 iceboxnet.exe-Hello2: Network: published endpoints for object adapter `Hello2':
    tcp -h 192.168.1.10 -p 20000:udp -h 192.168.1.10 -p 20000:ssl -h 192.168.1.10 -p 20001
 -- 3/2/2011 15:10:33:027 iceboxnet.exe: Network: attempting to bind to tcp socket 127.0.0.1:9996
 -- 3/2/2011 15:10:33:027 iceboxnet.exe: Network: accepting tcp connections at 127.0.0.1:9996
 -- 3/2/2011 15:10:33:034 iceboxnet.exe: Network: published endpoints for object adapter `Ice.Admin':
    tcp -h 127.0.0.1 -p 9996

更新

呻吟。上面的所有代码并不是绝对必要的(除非您要创建两个服务)。我所需要做的就是重命名适当的接口,请参阅 ZeroC 论坛以及如何在单个icebox 中运行两个服务

The key is in the user manual under: "43.3.4: Configuring a Service":

The name component of the property is the service name (IceStorm, in this
example). This name is passed to the service's start operation, and must be unique among
all services configured in the same Icebox server.

So - you need to have different interface names for each service (which makes a lot of sense: it needs a unique name for each service). We need to make a copy of interface "hello", and name it "hello2".

Add an extra line to config.icebox:

 # The hello service (2 identical copies)
 IceBox.Service.Hello=helloservice.dll:HelloServiceI --Ice.Config=config.service
 IceBox.Service.Hello2=helloservice2.dll:Hello2ServiceI --Ice.Config=config2.service

Create a copy of config.service, name it config2.service, and change the name and the port:

Hello.Endpoints=tcp -p 10000:udp -p 10000:ssl -p 10001

... edits to:

Hello2.Endpoints=tcp -p 20000:udp -p 20000:ssl -p 20001

Now, we need to compile a new version of "helloservice.dll" which uses "hello2" as the interface. Go through the C# project, and rename all "hello" to "hello2", rename the output of the compile to "helloservice2.dll" from "helloservice.dll".

Now, both services will start up under the same icebox, and if you turn logging on by altering the .config file:

 C:\Program Files (x86)\ZeroC\Ice-3.4.1\Ice-3.4.1-demos\democs\IceBox\hello>iceboxnet.exe --Ice.Config=config.icebox
 -- 3/2/2011 15:10:32:316 iceboxnet.exe-Hello: Network: attempting to bind to tcp socket 0.0.0.0:10000
 -- 3/2/2011 15:10:32:373 iceboxnet.exe-Hello: Network: accepting tcp connections at 0.0.0.0:10000
    local interfaces: 192.168.1.10, 127.0.0.1
 -- 3/2/2011 15:10:32:382 iceboxnet.exe-Hello: Network: attempting to bind to udp socket 0.0.0.0:10000
 -- 3/2/2011 15:10:32:429 iceboxnet.exe-Hello: Network: starting to receive udp packets
    local address = 0.0.0.0:10000
    local interfaces: 192.168.1.10, 127.0.0.1
 -- 3/2/2011 15:10:32:457 iceboxnet.exe-Hello: Network: attempting to bind to ssl socket 0.0.0.0:10001
 -- 3/2/2011 15:10:32:507 iceboxnet.exe-Hello: Network: accepting ssl connections at 0.0.0.0:10001
    local interfaces: 192.168.1.10, 127.0.0.1
 -- 3/2/2011 15:10:32:649 iceboxnet.exe-Hello: Network: published endpoints for object adapter `Hello':
    tcp -h 192.168.1.10 -p 10000:udp -h 192.168.1.10 -p 10000:ssl -h 192.168.1.10 -p 10001
 -- 3/2/2011 15:10:32:745 iceboxnet.exe-Hello2: Network: attempting to bind to tcp socket 0.0.0.0:20000
 -- 3/2/2011 15:10:32:794 iceboxnet.exe-Hello2: Network: accepting tcp connections at 0.0.0.0:20000
    local interfaces: 192.168.1.10, 127.0.0.1
 -- 3/2/2011 15:10:32:795 iceboxnet.exe-Hello2: Network: attempting to bind to udp socket 0.0.0.0:20000
 -- 3/2/2011 15:10:32:839 iceboxnet.exe-Hello2: Network: starting to receive udp packets
    local address = 0.0.0.0:20000
    local interfaces: 192.168.1.10, 127.0.0.1
 -- 3/2/2011 15:10:32:840 iceboxnet.exe-Hello2: Network: attempting to bind to ssl socket 0.0.0.0:20001
 -- 3/2/2011 15:10:32:885 iceboxnet.exe-Hello2: Network: accepting ssl connections at 0.0.0.0:20001
    local interfaces: 192.168.1.10, 127.0.0.1
 -- 3/2/2011 15:10:33:021 iceboxnet.exe-Hello2: Network: published endpoints for object adapter `Hello2':
    tcp -h 192.168.1.10 -p 20000:udp -h 192.168.1.10 -p 20000:ssl -h 192.168.1.10 -p 20001
 -- 3/2/2011 15:10:33:027 iceboxnet.exe: Network: attempting to bind to tcp socket 127.0.0.1:9996
 -- 3/2/2011 15:10:33:027 iceboxnet.exe: Network: accepting tcp connections at 127.0.0.1:9996
 -- 3/2/2011 15:10:33:034 iceboxnet.exe: Network: published endpoints for object adapter `Ice.Admin':
    tcp -h 127.0.0.1 -p 9996

Update

Groan. All the code above is not strictly necessary (unless you're creating two services). All I needed to do was rename the appropriate interfaces, see the ZeroC forums and How do I run two services in a single icebox?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文