WCF Service works with TCP Binding, but not with dualHttpBinding

Hello!

So, I have been working with a simple WCF service that I developed for the past month or so, and it is suddenly giving me problems. The service gives a WPF application access to a database stored on a server. Currently the database is stored locally, but it should be using a HTTP binding to communicate with the service as eventually the database will be stored elsewhere.

In any case, this is how the service works: it receives a request from the client asking for a list of records of a certain type from a database. It then generates the list of objects and sends the list back. This has been working since the service was first built, but now there seems to be a problem. When the list contains larger than 13 entities, the client does not seem to receive the object. The client throws a "TimeoutException" and stops functioning, while the service just keeps on going.

In an attempt to try and find the problem, we switched the binding over to a TcpNetBinding, which seems to work just fine, thus we know that the service works and there is a problem with our binding...we just can't seem to see what the problem is with our binding.

The connection between the client and host are done by using the ChannelFactory, where T is my service contract. We have created the binding programmatically, as opposed to using a WCF settings file, until we can get things working. The server side code to create the service is as follows:

Code Snippet

//create new service
_service = new AirtimeAdminService();
_admin = new ServiceHost(typeof(AirtimeAdminService),new Uri("net.tcp://localhost:8008/AirtimeAdminService"));

//** TEMPORARY WORKING CODE **

NetTcpBinding tcpbind = new NetTcpBinding();
_admin.AddServiceEndpoint(typeof(IAirtimeAdminService),tcpbind,"net.tcp://localhost:8008/AirtimeAdminService");

//** CODE THAT SERVICE SHOULD WORK WITH **

//_admin = new ServiceHost(typeof(AirtimeAdminService), new Uri("http://localhost:8080/AirtimeAdminService"));

//WSDualHttpBinding httpBind = new WSDualHttpBinding();
//_admin.AddServiceEndpoint(typeof(IAirtimeAdminService),httpBind, "http://localhost:8080/AirtimeAdminService");


_admin.Open();

As you can see, the working code is only different by the type of binding being used (along with the address). The client uses the following to create a connection:

Code Snippet

EndpointAddress address = new EndpointAddress("net.tcp://localhost:8008/AirtimeAdminService");
NetTcpBinding binding = new NetTcpBinding();
//create proxy by instantiating ChannelFactory

_channelFactory = new ChannelFactory<IAirtimeAdminService>(binding, address);

//create channel
_host = _channelFactory.CreateChannel();

The above code works with the TcpNetBinding, but I cannot seem to find a way to get it functioning using wsDualHttpBinding. Any ideas?

[3545 byte] By [DaveWesst] at [2008-1-7]
# 1

Dave have you tried increasing timeout values on your binding. By default most of these values will be 1 minute. See if that helps,

Code Snippet

WSDualHttpBinding binding = new WSDualHttpBinding();

binding.ReceiveTimeout = TimeSpan.FromMinutes(2.0);

binding.SendTimeout = TimeSpan.FromMinutes(2.0);

UtkarshShah-MSFT at 2007-10-2 > top of Msdn Tech,Visual Studio Orcas,Windows Communication Foundation (Indigo)...
# 2

Hi there!

Thanks for the quick reply. I tried increasing the timeout times as suggested, but it still seems to freeze up and not receive the object with a WsDualHttpBinding. We were thinking that it may have something to do with the amount of data.

Also, in case anyone suggests this, we have created a test class that checks to make sure the object being serialized is actually "WCF-Serializable", which it is.

Can anyone see why it would be getting blocked up?

DaveWesst at 2007-10-2 > top of Msdn Tech,Visual Studio Orcas,Windows Communication Foundation (Indigo)...
# 3

Do you have the same problems with WSHttpBinding or BasicHttpBinding? Is there a particular reason you are using WSDualHttpBinding?

DavidKreutz-MSFT at 2007-10-2 > top of Msdn Tech,Visual Studio Orcas,Windows Communication Foundation (Indigo)...
# 4

The reason we have decided to go with WSDualHttpBinding, is because the dual (or duplex) communication is required. When trying to get the service working originally, BasicHttpBinding was freezing up in the same way, except it wouldn't matter what data was being sent, it would not receive anything.

We have not tried WSHttpBinding, but I will try that immediately to see whether that makes a difference or not.

Thanks again!

DaveWesst at 2007-10-2 > top of Msdn Tech,Visual Studio Orcas,Windows Communication Foundation (Indigo)...
# 5

Well, I just finished implementing the WsHttpBinding rather than the WsDualHttpBinding, and everything seems to be working perfectly. It gave me a meaningful error message (that being, I should increase the MaxReceivedMessageSize property in the binding). In any case, it seems to be working quite well.

For a follow-up question, I was curious on knowing why my service would work using a WsHttpBinding, but not a WsDualHttpBinding. Any idea on that?

Thanks again for the help!

DaveWesst at 2007-10-2 > top of Msdn Tech,Visual Studio Orcas,Windows Communication Foundation (Indigo)...

Visual Studio Orcas

Site Classified