views:

88

answers:

1

I use WCF service to connect WPF front-end application with ERP back-end database.

I get an WCF service error: "The connection was closed unexpectedly" in my WPF application when trying to load table with many records (about 1000). Everything is going fine on tables with 10 - 20 records.

In my settings of the WCF service I have nothing conserning TimeOut settings. Maybe there are some timeout settings by default. How I can change this?

This is code with settings of my WCF service:

public void Start()
    {
        BasicHttpBinding binding = new BasicHttpBinding();
        binding.Name = "NAVBinding";
        binding.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard;
        Uri baseAddress = new Uri("http://localhost:8000/nav/customer");
        Customer_Service service = new Customer_Service();
        serviceHost = new ServiceHost(service, baseAddress);
        serviceHost.AddServiceEndpoint(typeof(ICustomer_Service), binding, baseAddress);
        OpenMetadataExchange(baseAddress);
        service.navEventListner = this;
        serviceHost.Open();
    }
+1  A: 

The problem is likely that the response is exceeding either the MaxReceivedMessageSize property of the client binding or the reader quotas.

tomasr
Thank you, Tomas. As you suggested, I tried to assign new maximum values to these properties up to 2147483647, for example: "binding.MaxReceivedMessageSize = 2147483647;" and so on, but closing still takes place. It seems there is something else about it.
rem
I am sorry, it appeared I was wrong about the number of records in the problem table. That number is not 1000 but about 53000. The total size of data in this table about 3,6 MB. I wonder, is this a critical records number for the WCF Service transferring?
rem
BTW, 1000 records transferred OK.
rem