Quantcast
Channel: ADO.NET, Entity Framework, LINQ to SQL, NHibernate
Viewing all articles
Browse latest Browse all 1698

There is already an open DataReader associated with this Command which must be closed first

$
0
0

I have this unexplained error coming from my WebService.asmx.

20180915.01:02:21 UTC : QBWebConnector.SOAPWebService.do_sendRequestXML() : QBWC1041: SendRequestXML failed.

In the SendRequestXML method a call is made to buildRequest() which checks if any data needs to be send. These are all EF queries.

public ArrayList buildRequest()
        {
            var dbContext = new VTEntities1();

            //owners that need to be added
            var addOwners = dbContext.Owners.Where(o => o.EnteredByProviderId == theprovider && o.AddOwner == true /*&& o.ListId == null*/);

            //owners that need to be verified
            var verifyOwners = dbContext.Owners.Where(o => o.EnteredByProviderId == theprovider && o.VerifyCustomer == true /*&& o.ListId != null*/);

            //owners that need to be updated
            var updateOwners = dbContext.Owners.Where(o => o.EnteredByProviderId == theprovider && o.UpdateCustomer == true /*&& o.ListId != null*/);

            //ItemsTxns to be added
            var addTxns = dbContext.Transactions.Where(t => t.ProviderId == theprovider && t.AddTransaction == true/* && t.ListItemId == null*/);

            //Txns need verification
            var verifyTxns = dbContext.Transactions.Where(t => t.ProviderId == theprovider && t.VerifyTransaction == true);

            int i = 0;

            foreach (var item in addOwners)
            {
                //do CustomerAdd
                var custAdd = new XmlRqCreate().CustomerAddRq(item, i.ToString());

                i++;
                req.Add(custAdd);
            }
etc.

is the above code a potential candidate for generating these "open DataReader" issues?

By the way this only happens in the live environment, locally there is no such error message.

Error message: Server was unable to process request. ---> An error occurred while executing the command definition. See the inner exception for details. ---> There is already an open DataReader associated with this Command which must be closed first.

More info:

StackTrace =    at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)

   at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)

   at QBWebConnector.localhost.WCWebServiceDoc.sendRequestXML(String ticket, String strHCPResponse, String strCompanyFileName, String qbXMLCountry, Int32 qbXMLMajorVers, Int32 qbXMLMinorVers)

   at QBWebConnector.localhost.WCWebService.sendRequestXML(String ticket, String strHCPResponse, String strCompanyFileName, String qbXMLCountry, Int32 qbXMLMajorVers, Int32 qbXMLMinorVers)

   at QBWebConnector.SOAPWebService.sendRequestXML(String wcTicket, String HCPResponseXML, String cfn, String qbNationality, Int32 qbXMLMajorVers, Int32 qbXMLMinorVers)

   at QBWebConnector.WebService.do_sendRequestXML(Int32 x, String wcTicket, String HCPResponseXML, String cfn, String qbNationality, Int32 qbXMLMajorVers, Int32 qbXMLMinorVers, Boolean& timeout)


Viewing all articles
Browse latest Browse all 1698

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>