Alw1n
asked on
WCF named pipe operation timeout
Hi,
I am new to WCF and have created a small test app (server and client all contained in one win form). When testing the client bit seems to find the server but eventually times out, it seems that the server method is not returning in time.
Please see if you can see what I am doing wrong in the code below :
[ServiceContract]
public interface IReturnText
{
[OperationContract]
string ReturnSomeText(string value);
}
public class ReturnText : IReturnText
{
public string ReturnSomeText(string value)
{
return "returned: " + value;
}
}
private ServiceHost host;
private void bStartService_Click(object sender, EventArgs e)
{
host = new ServiceHost(typeof(ReturnT ext),
new Uri[]{
new Uri("net.pipe://localhost" )
});
host.AddServiceEndpoint(ty peof(IRetu rnText), new NetNamedPipeBinding(NetNam edPipeSecu rityMode.N one), "MyPipe");
host.Open();
}
private void bStopService_Click(object sender, EventArgs e)
{
host.Close();
}
private void bUserService_Click(object sender, EventArgs e)
{
ChannelFactory<IReturnText > pipeFactory =
new ChannelFactory<IReturnText >(
new NetNamedPipeBinding(NetNam edPipeSecu rityMode.N one),
new EndpointAddress("net.pipe: //localhos t/MyPipe") );
IReturnText pipeProxy = pipeFactory.CreateChannel( );
((IContextChannel)pipeProx y).Operati onTimeout = new TimeSpan(0, 0, 5);
string s = pipeProxy.ReturnSomeText(" abc");
}
I am new to WCF and have created a small test app (server and client all contained in one win form). When testing the client bit seems to find the server but eventually times out, it seems that the server method is not returning in time.
Please see if you can see what I am doing wrong in the code below :
[ServiceContract]
public interface IReturnText
{
[OperationContract]
string ReturnSomeText(string value);
}
public class ReturnText : IReturnText
{
public string ReturnSomeText(string value)
{
return "returned: " + value;
}
}
private ServiceHost host;
private void bStartService_Click(object
{
host = new ServiceHost(typeof(ReturnT
new Uri[]{
new Uri("net.pipe://localhost"
});
host.AddServiceEndpoint(ty
host.Open();
}
private void bStopService_Click(object sender, EventArgs e)
{
host.Close();
}
private void bUserService_Click(object sender, EventArgs e)
{
ChannelFactory<IReturnText
new ChannelFactory<IReturnText
new NetNamedPipeBinding(NetNam
new EndpointAddress("net.pipe:
IReturnText pipeProxy = pipeFactory.CreateChannel(
((IContextChannel)pipeProx
string s = pipeProxy.ReturnSomeText("
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER