Azure WebRole 中的套接字/超时用于与 WorkerRole 中的 WCF 主机进行同步通信
我正在尝试让它在内部 TCP 连接上工作。该代码在开发中运行完美,但是当部署到 Azure 时,我得到...
一个 CommunicationException“套接字连接已中止”,试图连接到“net.tcp://......”,时间代码约为 60 秒它等待着。
wcf 主机端:
_WCFHost.AddServiceEndpoint(typeof(IServiceWCFContract), new NetTcpBinding(),_ServiceUrl);
_WCFHost.Open();
wcf 客户端:
var channelfactory = new ChannelFactory<IServiceWCFContract>(new NetTcpBinding(), service.Url);
channelfactory.Open(new TimeSpan(0,0,20)); //20 sec timeout
var resp = channel.GetValues();
我确定我从 RoleEnvironment.Roles["WcfWorkerRole"].Instances 获取正确的 url
我已确保在两个角色的 .csdef 中设置了enableNativeCodeExecution = "true" 。
我也尝试过基本的 http 绑定,但 azure 不喜欢具有 http: 名称空间的辅助角色。
I'm trying to get this to work on an internal tcp connection. The code runs flawlessly in development but when deployed to Azure I get ...
a CommunicationException "The socket connection was aborted" trying to connect to "net.tcp://......" with a time code about 60 seconds it waited.
wcf host side:
_WCFHost.AddServiceEndpoint(typeof(IServiceWCFContract), new NetTcpBinding(),_ServiceUrl);
_WCFHost.Open();
wcf client side:
var channelfactory = new ChannelFactory<IServiceWCFContract>(new NetTcpBinding(), service.Url);
channelfactory.Open(new TimeSpan(0,0,20)); //20 sec timeout
var resp = channel.GetValues();
I'm sure I'm grabbing the correct url from the RoleEnvironment.Roles["WcfWorkerRole"].Instances
I've made sure enableNativeCodeExecution = "true" is set in the .csdef in both roles.
Ive tried basic http binding too, but azure doesn't like the worker roles having http: names spaces.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 windows azure 论坛上有很多 帖子表明当前不支持 tcp 绑定。我会尝试将端点更改为 wsHttp 并检查是否有效。
on the forum of windows azure there are a lot of posts suggesting that a tcp binding is currently not supported. I would try changing the endpoint to wsHttp and checking if that works.