WCF NetTcpBinding IP-帮助! [英] WCF NetTcpBinding IP --Help!!

查看:88
本文介绍了WCF NetTcpBinding IP-帮助!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我想在局域网中不同计算机上的2个wcf应用程序之间进行通信.以下代码不起作用,我也不知道为什么:
{无应用配置}
ServiceHost:
----------------

Hi,

I want to communicate between 2 wcf applications on different machine in a local network. The following code don''t work and i am clueless why:
{no app config}
ServiceHost:
----------------

ServiceHost host = new ServiceHost(typeof(MyFRWcfService));
string myIP = "192.168.1.2";
NetTcpBinding binding = new NetTcpBinding();
binding.MaxBufferPoolSize = (int)67108864;
binding.MaxBufferSize = (int)67108864;
binding.MaxReceivedMessageSize = (int)67108864;
binding.MaxConnections = 50;
binding.ReceiveTimeout = TimeSpan.MaxValue; 
host.AddServiceEndpoint(
    typeof(IFRWcfContract),
    binding,
    "net.tcp://" + myIP + ":8080/MyFRWcfService");


----------------
客户:


----------------
Client:

string serverIP = "192.168.1.2";
NetTcpBinding binding = new NetTcpBinding();
DuplexChannelFactory<ifrwcfcontract> scf;
scf = new DuplexChannelFactory<ifrwcfcontract>(
    this,binding,new EndpointAddress(
         "net.tcp://" + serverIP + ":8080/MyFRWcfService"));
IFRWcfContract activator = scf.CreateChannel();
activator.Hello();</ifrwcfcontract></ifrwcfcontract>


----------------
我的错误是"TCP错误10060"-尝试从合同中激活功能时,客户端计算机在最后一条命令上没有任何答案.

我做错了什么?

请帮忙,我尝试了许多解决方案,没有任何帮助.


----------------
My error is "TCP error 10060" - The client computer get no answer on the last command, when trying to activate a function from the contract.

What am I doing wrong?

Please help, i tried numerous solutions, none work.

推荐答案

尝试以下方法:
1-您打开主机了吗?如果不是,那就是问题!
2-注释掉与其他设置有关的代码(例如MaxBufferPoolSize,..)并仅使用默认设置
3-尝试在客户端使用代理(使用SvcUtil创建代理文件)
祝你好运:)
Try these:
1- Have you opened the host? If not this is the problem!
2- Comment out codes related to extra settings(like MaxBufferPoolSize,..) & just use the defaults
3- Try using a proxy on client side (use SvcUtil to create a proxy file)
good luck :)


这篇关于WCF NetTcpBinding IP-帮助!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆