gpt4 book ai didi

wcf - Azure WebRole 中的套接字/超时用于与 WorkerRole 中的 WCF 主机进行同步通信

转载 作者:行者123 更新时间:2023-12-02 07:32:36 26 4
gpt4 key购买 nike

我正在尝试让它在内部 TCP 连接上工作。代码在开发中运行完美,但是当部署到 Azure 时,我得到...

尝试连接到“net.tcp://......”时出现 CommunicationException“套接字连接已中止”,时间代码等待了大约 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 绑定(bind),但 azure 不喜欢具有 http: namespace 的辅助角色。

最佳答案

windows azure论坛上有很多posts表明当前不支持 tcp 绑定(bind)。我会尝试将端点更改为 wsHttp 并检查是否有效。

关于wcf - Azure WebRole 中的套接字/超时用于与 WorkerRole 中的 WCF 主机进行同步通信,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2220719/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com