简体   繁体   English

将WCF ServiceHost路由到另一台计算机

[英]Route WCF ServiceHost to another computer

GoodDay, 美好的一天,

I'm not a guru when it comes to WCF, but i do know the basics. 在WCF方面,我不是专家,但我确实知道一些基础知识。

My question is, how do i create a ServiceHost on machine X, while the code is on machine Y? 我的问题是,当代码在机器Y上时,如何在机器X上创建ServiceHost?

if i build and run this code on my dev machine(localhost) : 如果我在我的开发机器(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). 必须在数据中心服务器上完成什么实现,以便如果我必须指向http://my.datacenter.com/MyApp/MyService1 ,它将把服务操作路由到我的开发机(本地主机)。

However, the datacenter should not be accessible via the internet. 但是,不应通过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. 我们正在研究一种可能的基础架构,以查看是否可以创建服务总线类型的体系结构,以便所有客户都可以仅通过调用我们的数据中心URL来调用在各自计算机上运行的其他客户服务。

We have looked at Windows Azure, but we have our own datacenter infrasture that we wish to leverage off. 我们已经研究过Windows Azure,但是我们希望利用我们自己的数据中心基础设施。 Come think of it, we kind of building our own Azure, on a very very basic scale. 想到这一点,我们就可以在非常基本的规模上构建自己的Azure。

How does one go creating this? 如何创建这个?

Thanks in Advance 提前致谢

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. .NET 4中的WCF具有一项称为路由服务的新功能,该功能可以完成某些工作-客户端将连接并将其消息发送到计算机A,而该计算机基本上只是将请求重新路由到计算机B。

Check out these resources (or find a lot more by googling or binging for "WCF 4 Routing service"): 签出这些资源(或通过搜索或查询“ WCF 4路由服务”找到更多资源):

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM