WCF - 不使用 IIS 的远程服务 - 基地址?
我正在尝试了解 WCF 服务的寻址。
我们有一个客户端-服务器设置,其中服务器偶尔(可能每天一次)需要将数据推送到每个客户端。我希望在 NT 服务中托管的每个客户端上都有一个轻量级 WCF 侦听器服务来接收该数据。我们已经有了这样一个 NT 服务设置,托管一些用于其他任务的本地 WCF 服务,因此其开销是最小的。
由于服务器上现有的遗留代码,我认为该服务需要公开为 ASMX 并使用 basicHttpBinding 来允许它连接。
每个客户端都由用户在服务器上注册(他们需要单独配置它们),因此发现不是问题。
我的问题是,寻址是如何工作的?我想象用户以表单
http://0.0.0.0/MyService
或什至
http://hostname/MyService
在服务器上输入客户端地址。如果是这样,我如何在其 App.config 中配置客户端服务?我是否使用localhost
?
如果不是,那么向服务器公开服务的推荐方式是什么?
注意:
- 我不想在 IIS 中托管,因为这会给客户端所需的硬件增加额外的要求。
- 客户端几乎肯定位于 LAN 上,而不是公共互联网上
I'm trying to get my head around the addressing of WCF services.
We have a client-server setup where the server occasionally (maybe once a day) needs to push data to each client. I want to have a lightweight WCF listener service on each client hosted in an NT service to receive that data. We already have such an NT service setup hosting some local WCF services for other tasks so the overhead of this is minimal.
Because of existing legacy code on the server I believe the service needs to be exposed as ASMX and use basicHttpBinding
to allow it to connect.
Each client is registered on the server by the user (they need to configure them individually) so discovery is not the issue.
My question is, how does the addressing work? I imagine the user entering the client's address on the server in the form
http://0.0.0.0/MyService
or even
http://hostname/MyService
If so, how do I configure the client service in its App.config? Do I use localhost
?
If not then what is the reccommended way of exposing the service to the server?
Note:
- I don't want to host in IIS as that adds extra requirements to the hardware required for the client.
- The clients will be almost certainly located on LANs, not over the public internet
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以像这样配置服务的基地址:
然后可以通过
http://servename:9999/foo
访问您的服务。您可以查看本文了解更多信息。You configure the base address of the service like so:
And then your service could be accessible through
http://servename:9999/foo
. You may take a look at this article for more information.