locked
Communication Error when returning a data set from a WCF Service to ASP.net WebPage RRS feed

  • Question

  • Good Day, 

    I have a problem with WCF Service Code, I am able to send or rather return a bool, string, int etc from a wcf service to asp.net page for login in purposes, but for some reason i get this error message when returning a data set, here is my code for the service:

    public System.Data.DataSet ReturnCustomers()
    {
     	DataEntity.NorthwindDataSet dsNorthwind = new DataEntity.NorthwindDataSet();
    	DataAccess.NorthwindDataSetTableAdapters.CustomersTableAdapter taCust = new DataAccess.NorthwindDataSetTableAdapters.CustomersTableAdapter();
    
    	dsNorthwind.EnforceConstraints = false;
    	taCust.FillByCustomers(dsNorthwind.Customers);
    
    	return dsNorthwind;
    }

    Now here is my code to accept the data set on the presentation layer:

    protected void Button1_Click(object sender, EventArgs e)
        {
            ServiceReference1.Service1Client custService = new ServiceReference1.Service1Client();
            System.Data.DataSet dsCust;
    
            dsCust = custService.ReturnCustomers();
            GridView1.DataSource = dsCust;
            GridView1.DataBind();
        }

    The error i get when clicking button 1 is as follows:

    An error occurred while receiving the HTTP response to http://localhost:8732/Design_Time_Addresses/ServiceNorthwind/Service1/. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details.

    I have researched and all i could come up with was that the dataset is too large but i have seen people able to return even larger datasets with pretty much the same code...

    any idea as to what i am doing wrong??

    Thanks in advance...





    Warren van Tonder - Junior Microsoft Certified Professional Developer

    Thursday, October 18, 2012 5:09 PM

All replies

  • Hi

    Sometimes you get misleading error messages in WCF framework. So I would suggest enable tracing in your service that will tell you what exactly go wrong in WCF service layer. Sometimes error encapsulated in Service layer and much higher level message are sent to client ... like channel shutdown or service not available ....

    Did you try sending a smaller dataset ? Is that work ?

    You can send back larger data through wcf service as well. You need to customize the binding and service configuration in the configuration file..

    Have a look at this blog post ... i have detailed out how to confiure wcf service to send large data ....

    if your data is too large then you need to implement streaming in your service operation.

    Tanvir Huda Application Architect/Consultant http://thetechnocrate.wordpress.com/

    Friday, October 19, 2012 1:02 AM
  • This is what i get in the output window even after changing all of the config files.

    A first chance exception of type 'System.ServiceModel.CommunicationException' occurred in mscorlib.dll

    must be size?

    through testing i have now sent my data set over using  a data contract by defining all table column names as variables and stored each customer within a list.

    Is this a proper way of doing it?

    The only problem is this is such a long and tedious process in terms of completion time, that it seems its not an efficient way?

    i will try implement streaming thanks, any idea how to implement streaming?


    Warren van Tonder - Junior Microsoft Certified Professional Developer

    Friday, October 19, 2012 12:38 PM