简体   繁体   English

Windows Azure VM上的WCF wsdualhttpbinding绑定

[英]WCF wsdualhttpbinding binding on Windows Azure VM

We have a WCF application with multiple bindings running on Windows Services, the application is working as expected on an intranet environment however when we deployed our solution to windows azure VM, it seems all our services are running fine except those that uses wsdualhttpbinding binding !!! 我们有一个WCF应用程序,它在Windows服务上运行了多个绑定,该应用程序在Intranet环境中按预期工作,但是当我们将解决方案部署到Windows Azure虚拟机时,除使用wsdualhttpbinding绑定的服务外,我们所有的服务似乎都运行良好! !

Our services are running on port 8099 therefore we created an endpoint on VM with public and private ports set to 8099, we also disabled the firewall for the time being. 我们的服务在端口8099上运行,因此我们在VM上创建了一个终结点,并将公共端口和私有端口设置为8099,我们还暂时禁用了防火墙。 we even try to use Azure network to establish a point to site VPN but none of them worked. 我们甚至尝试使用Azure网络建立指向站点VPN的点,但是它们都不起作用。

we set the base address as http://XXX.cloudapp.net:8099/MYSvc but again same issue... This solution is working fine if I run the client application on the same machine that hosts the services on azure however if I try to use another machine it fails. 我们将基本地址设置为http://XXX.cloudapp.net:8099/MYSvc,但是同样存在问题...如果我将客户端应用程序运行在承载Azure上的服务的同一台计算机上,则此解决方案运行良好尝试使用另一台失败的计算机。 I even tried to create another VM on the same subnet and run the client app from within azure network to replicate an Intranet environment, again no success... 我什至尝试在同一子网上创建另一个VM,然后从azure网络中运行客户端应用程序以复制Intranet环境,再次没有成功...

There is no error to copy here, it seems when the client app reaches a duplex service, it keeps waiting for a response and does not allow user to do anything! 没有错误要复制到此处,似乎客户端应用程序到达双工服务时,它一直在等待响应,并且不允许用户执行任何操作!

Is it because of traffic routing or .... any suggestion? 是因为流量路由还是....任何建议? are we missing something? 我们错过了什么吗? We prefer to use wsdualhttpbinding unless there is no solution... 除非没有解决方案,否则我们倾向于使用wsdualhttpbinding。

Since nobody answered the question and due to the fact I found a solution, I like to share it here in case somebody need it. 由于没有人回答这个问题,并且由于我找到了解决方案,因此我想在这里分享它,以防有人需要。

On azure wsdualhttpbinding cannot find the client address just because of routing issues, so even if you use VPN the issue persists. 在azure上,仅由于路由问题,wsdualhttpbinding无法找到客户端地址,因此即使使用VPN,问题仍然存在。

The solution is to use ClientBaseAddress as for your wsdualhttpbinding binding like so: 解决方案是将ClientBaseAddress用于您的wsdualhttpbinding绑定,如下所示:

WSDualHttpBinding dualBinding = new WSDualHttpBinding();
EndpointAddress endptadr = new EndpointAddress("http://XXX:12000/DuplexTestUsingCode/Server");
dualBinding.ClientBaseAddress = new Uri("http://XXX:8000/DuplexTestUsingCode/Client/");

refer to this link http://msdn.microsoft.com/en-us/library/system.servicemodel.wsdualhttpbinding.clientbaseaddress(v=vs.110).aspx 请参阅此链接http://msdn.microsoft.com/zh-cn/library/system.servicemodel.wsdualhttpbinding.clientbaseaddress(v=vs.110).aspx

and aslo here: http://social.msdn.microsoft.com/Forums/vstudio/en-US/e5fca7a5-9a90-48de-a81c-ec2e18b7ae6a/wsdualhttpbinding-and-clients-on-remote-machines 并在此处访问: http//social.msdn.microsoft.com/Forums/vstudio/en-US/e5fca7a5-9a90-48de-a81c-ec2e18b7ae6a/wsdualhttpbinding-and-clients-on-remote-machines

You have to bear in mind that the load balancer closes any idle connections after one minute. 您必须记住,负载平衡器在一分钟后关闭所有空闲连接。 You can't turn off this behavior on Azure, so if your process takes more than a minutes, the callback channel will be closed by load balancer and you get timeout exception. 您无法在Azure上关闭此行为,因此,如果您的过程耗时超过一分钟,则负载平衡器将关闭回调通道,并且您会收到超时异常。

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

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