我试图让它在内部 tcp 连接上工作。代码在开发中完美运行,但是当部署到 Azure 时,我得到...
一个 CommunicationException "The socket connection was aborted" 试图连接到 "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
我确保 enableNativeCodeExecution = "true" 在两个角色的 .csdef 中都设置了。
我也尝试过基本的 http 绑定,但 azure 不喜欢具有 http: 命名空间的工作角色。