将 WCF ServiceHost 路由到另一台计算机
GoodDay,
我不是 WCF 方面的专家,但我确实了解基础知识。
我的问题是,当代码位于机器 Y 上时,如何在机器 X 上创建 ServiceHost?
如果我在我的开发机器(localhost)上构建并运行此代码:
servicehost = new ServiceHost(typeof(MyService1));
servicehost.AddServiceEndpoint(typeof(IMyService1), new NetTcpBinding(),"net.tcp://my.datacenter.com/MyApp/MyService1"); //This is normally set to localhost.
必须在数据中心服务器上执行什么实现,以便我必须指向 http://my.datacenter.com/MyApp/MyService1 ,它将把服务操作路由到我的开发机器(localhost)。
但是,数据中心不应通过互联网访问。
我们正在研究一个可能的基础设施,看看我们是否可以创建一个服务总线类型的架构,以便我们所有的客户都可以通过调用我们的数据中心 URL 来调用在各自机器上运行的其他客户服务。
我们已经研究过 Windows Azure,但我们有自己的数据中心基础设施,我们希望利用它。想想看,我们在非常非常基本的规模上构建了自己的 Azure。
如何创建这个?
提前致谢
GoodDay,
I'm not a guru when it comes to WCF, but i do know the basics.
My question is, how do i create a ServiceHost on machine X, while the code is on machine Y?
if i build and run this code on my dev machine(localhost) :
servicehost = new ServiceHost(typeof(MyService1));
servicehost.AddServiceEndpoint(typeof(IMyService1), new NetTcpBinding(),"net.tcp://my.datacenter.com/MyApp/MyService1"); //This is normally set to localhost.
What implementation must be done on the datacenter server, so that if i had to point to http://my.datacenter.com/MyApp/MyService1 , it will route the service operation to my dev machine (localhost).
However, the datacenter should not be accessible via the internet.
It is a possible infrastructure that we researching to see if we can create a service bus type architecture so that all our customers can invoke other customer services running on their respective machines just by calling our datacenter url.
We have looked at Windows Azure, but we have our own datacenter infrasture that we wish to leverage off. Come think of it, we kind of building our own Azure, on a very very basic scale.
How does one go creating this?
Thanks in Advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
.NET 4 中的 WCF 有一个称为路由服务的新功能,它可以完成其中的一些工作 - 客户端将连接并将其消息发送到机器 A,而该机器基本上只是将请求重新路由到机器 B。
查看这些资源(或者通过谷歌搜索或搜索“WCF 4 路由服务”找到更多信息):
WCF in .NET 4 has a new feature called the routing service which does some of that - the clients will connect and send their messages to machine A, while that machine basically just re-routes the request to machine B.
Check out these resources (or find a lot more by googling or binging for "WCF 4 Routing service"):