none
The underlying connection was closed: The connection was closed unexpectedly. RRS feed

  • Question

  •  

    Hi ,

     

    I am working with wcf and linq  and i am facing a problem"The underlying connection was closed: The connection was closed unexpectedly. " when i am trying to return my linq query to the client.I tried for changing the code in web.config for client and server.like

     

    Client :

     

    <behaviors>

    <endpointBehaviors>

    <behavior name="debuggingBehaviour">

    <dataContractSerializer maxItemsInObjectGraph="2147483646" />

                               </behavior>

                         </endpointBehaviors>

                  </behaviors>

    <endpoint address="http://localhost/Host/Internal/myservice.svc" binding="basicHttpBinding"

                                        bindingConfiguration="BasicHttpBinding_IMyService" contract="LeadsServiceInternal.IMyService" name="BasicHttpBinding_IMyService"

                                 behaviorConfiguration="debuggingBehaviour"

                                        />

     

    Server :

     

    <behavior name="MyService.ServiceImplementation.MyService_Behavior">

                                      <serviceDebug includeExceptionDetailInFaults="true" />

                                      <serviceMetadata httpGetEnabled="true" />

                                      <dataContractSerializer maxItemsInObjectGraph="2147483646"/>

                               </behavior>

                         </serviceBehaviors>

     

    i want to bind the data to the grid which linq return as a query.

    i am returning my linq query as in the method

    public IQueryable GetGroupPermissions(string strGroupId, int appLevel, string strAclName)

    {

    var getGroupPermissionsQuery2 = from objGroup in objUser1

    from objPrm in objUser2

    where objGroup1.GROUP_ID.ToString() == strGroupId &&

    objPrm.SYSTEM_DEFINED == 0 &&

    objPrm.APPLICATION_LEVEL == appLevel

    select new

    {

    objGroup.GROUP_NAME,

    objPrm.PERMISSION_ID,

    objPrm.PERMISSION_NAME

    };

     

     

    return getGroupPermissionsQuery.ToList();

    }

     

    i am binding it to my grid like

     

    IQueryable objList =objSecurityService.GetGroupPermissions(strSelGroupId, 1, "echoApp").ToList();

    Grid.DataSource = objList;

    Grid.DataBind();

     

     

    Please help me ..

     

    Thanks,

    Sk

     

     

    Thursday, May 22, 2008 4:39 AM

Answers

  • Hi. I just had the same problem. 

     

    The issue was that I had changed the contract but had forgotten to go back to the client and updated the Service Reference.  When I did it started working as expected.

     

    HTH!

     

    Regards

    Dave A

    Monday, July 7, 2008 10:50 AM

All replies

  • Hi Shiva,

     

    This can be because of lots of things, but most likely the exception is happening on the service side and client gets the fault.

     

    If you can turn the logging on in service's configuration and log the errors and the messages on the service side, you'll be able to see the real error with our intended stack trace.

     

    Or alternatively, if your wcf host is local, you can attach the debugger to it and see which line the service throws that particular exception.

     

    If you have tests for services try to run them and see if the problem is a communication problem or something else.

     

    Thanks,

     

    Sidar

    Thursday, May 22, 2008 11:31 AM
  • Hi Sidar,

     

    I debug the wcf service and it is returning also.after completion of the execution for the method in wcf then error occurs.

     

    Shiva

     

    Thursday, May 22, 2008 11:59 AM
  • Hey Shiva

     

    Try to turn the logging mode to Verbose and Errors, let's see what does it say. And also, how is this service hosted ?

     

    Thursday, May 22, 2008 1:01 PM
  • I have a wcf service under project solution

     

    Shiva

     

    Thursday, May 22, 2008 1:09 PM
  • Hi Shiva, back to the issue.

     

    If you could create a small vs 2008 solution for the sake of repro, we would dig it further. 

     

     

    Friday, May 23, 2008 10:26 PM
  • Hi,

     

    It is so need full for me.

     

    Please help some one.

     

    Thanks,

    Shiva

    Saturday, May 24, 2008 6:27 AM
  • Hi. I just had the same problem. 

     

    The issue was that I had changed the contract but had forgotten to go back to the client and updated the Service Reference.  When I did it started working as expected.

     

    HTH!

     

    Regards

    Dave A

    Monday, July 7, 2008 10:50 AM
  • a data contract attribute missing on a derived class can also be a problem.  it wont cause a compile time issue if your service uses a base that has the attribute but both base and derived require it.

    regards!
    john
    Friday, April 10, 2009 12:03 AM