在WCF中通过net.pipe运行多个服务

时间:2022-06-29 08:25:55

I am building a distributed application that will require 6 different services. I will have to demo the application on my XP laptop using Visual Studio 2008.

我正在构建一个需要6种不同服务的分布式应用程序。我将不得不使用Visual Studio 2008在我的XP笔记本电脑上演示应用程序。

Is it possible to run multiple services on localhost at the same time, all using net.pipe?

是否可以同时在localhost上运行多个服务,全部使用net.pipe?

For example:

net.pipe://localhost/DirectoryService
net.pipe://localhost/MathService

If not, is there any other way to host these WCF services without using IIS/webdev server? net.tcp? Something else?

如果没有,有没有其他方法来托管这些WCF服务而不使用IIS / webdev服务器?的net.tcp?别的什么?

3 个解决方案

#1


Yes, providing the binding addresses are unique. The two examples you've shown will work fine with the net.pipe binding.

是的,提供绑定地址是唯一的。您展示的两个示例可以与net.pipe绑定一起使用。

Keep in mind the net.pipe binding will only work on the local machine. If you want your services to be accessible from remote machines, you'll need to use a different binding, such as net.tcp. That said, net.pipe is the recommended binding to use if your services run on the localhost because it is more efficient that the other bindings.

请记住,net.pipe绑定仅适用于本地计算机。如果您希望从远程计算机访问您的服务,则需要使用不同的绑定,例如net.tcp。也就是说,如果您的服务在localhost上运行,net.pipe是推荐使用的绑定,因为它比其他绑定更有效。

#2


Another thing you should know about net.pipe addresses is that you are providing a URN, not a URL. net.pipe is an in-memory implementation and the "address" you are specifying can be anything.

您应该了解net.pipe地址的另一件事是您提供的是URN,而不是URL。 net.pipe是一个内存实现,你指定的“地址”可以是任何东西。

net.pipe://IHateCats
net.pipe://NamedPipes/Are/Fast

These will all work, regardless of any other factor. It's just the unique identifier for that named pipe. The network stack is not involved with this form of communication.

无论任何其他因素,这些都将起作用。它只是该命名管道的唯一标识符。网络堆栈不涉及这种形式的通信。

#3


You can use HTTP as a service end point without IIS, take a look at the ServiceHost class. That's what I use for local WCF tesing and it works very well.

您可以使用HTTP作为服务端点而不使用IIS,请查看ServiceHost类。这就是我用于本地WCF测试的效果,并且效果非常好。

#1


Yes, providing the binding addresses are unique. The two examples you've shown will work fine with the net.pipe binding.

是的,提供绑定地址是唯一的。您展示的两个示例可以与net.pipe绑定一起使用。

Keep in mind the net.pipe binding will only work on the local machine. If you want your services to be accessible from remote machines, you'll need to use a different binding, such as net.tcp. That said, net.pipe is the recommended binding to use if your services run on the localhost because it is more efficient that the other bindings.

请记住,net.pipe绑定仅适用于本地计算机。如果您希望从远程计算机访问您的服务,则需要使用不同的绑定,例如net.tcp。也就是说,如果您的服务在localhost上运行,net.pipe是推荐使用的绑定,因为它比其他绑定更有效。

#2


Another thing you should know about net.pipe addresses is that you are providing a URN, not a URL. net.pipe is an in-memory implementation and the "address" you are specifying can be anything.

您应该了解net.pipe地址的另一件事是您提供的是URN,而不是URL。 net.pipe是一个内存实现,你指定的“地址”可以是任何东西。

net.pipe://IHateCats
net.pipe://NamedPipes/Are/Fast

These will all work, regardless of any other factor. It's just the unique identifier for that named pipe. The network stack is not involved with this form of communication.

无论任何其他因素,这些都将起作用。它只是该命名管道的唯一标识符。网络堆栈不涉及这种形式的通信。

#3


You can use HTTP as a service end point without IIS, take a look at the ServiceHost class. That's what I use for local WCF tesing and it works very well.

您可以使用HTTP作为服务端点而不使用IIS,请查看ServiceHost类。这就是我用于本地WCF测试的效果,并且效果非常好。