WCF net.tcp绑定服务使用
我有以下WCF客户端代码来使用WCF服务:WCF net.tcp绑定服务使用,wcf,Wcf,我有以下WCF客户端代码来使用WCF服务: static void Main(string[] args) { IService1 vService; NetTcpBinding b = new NetTcpBinding(); b.Security.Mode = SecurityMode.Message; b.Security.Message.ClientCredentialType
static void Main(string[] args)
{
IService1 vService;
NetTcpBinding b = new NetTcpBinding();
b.Security.Mode = SecurityMode.Message;
b.Security.Message.ClientCredentialType = MessageCredentialType.Windows;
EndpointAddress vEndPoint = new EndpointAddress("net.tcp://115.127.1.226/myservice/");
ChannelFactory<IService1> cf = new ChannelFactory<IService1>(b, vEndPoint);
vService = cf.CreateChannel();
try
{
Console.WriteLine("Result from the system " + vService.HellowWorld());
}
catch (Exception ex)
{
Console.WriteLine("Error Occured while connection establish to " + vEndPoint.Uri.ToString());
}
Console.ReadKey();
}
尝试使用
ServiceBusEnvironment.SystemConnectivity.Mode=ConnectivityMode.Http
Could not connect to net.tcp://115.127.1.226/myservice/. The connection attempt lasted for a time span of 00:00:21.0282028. TCP error code 10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
115.127.1.226:808.