Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6052175
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:53:58+00:00 2026-05-23T07:53:58+00:00

We have a ASP.Net web application that connects to its business layer using WCF.

  • 0

We have a ASP.Net web application that connects to its business layer using WCF. Sometimes, I am getting exception when it is performing a huge operation. The interesting part is when I ran it for the first time it was successful. Afterwards it is throwing exception.

Exception: The socket connection was aborted.

The operation is that it uploads zipcodes into database tables from a csv file. First we read from csv file and make a single lengthy string of zipcodes. This is passed to the stored procedure and the database operations are performed.

Note 1:) When I placed breakpoint and tested, it is clear that the creation of the string (after taking data from csv and appending) is pretty fast (less than one minute).

Note 2:) I removed the transaction (from C# code) and tested, even then the exception is there.

Note 3:) There are one lakh (one hundred thousand) records in csv. Each row has four columns (ZipCode, City, County, State). Size of the csv file is 3MB.

I had a doubt about the transaction log size. Then I shrinked the log file using the following command.
DBCC SHRINKFILE(‘MyDB_log’, 1) GO

Then I checked the log size using SELECT [Size],Max_Size,Data_Space_Id,[File_Id],Type_Desc,[Name] FROM FRAMIS_R2075.sys.database_files WHERE data_space_id = 0

The Size is 128; Max Size is 268435456; Type_Desc = “LOG”

Even after shrinking the exception is still coming.

Framework: .Net 3.0

DB: SQL Server 2005

Well, it seems like there is an excpetion in the business layer too, when I waited for 20 more minutes. It said, “Invalid Attempt to call Read when the reader is called”. By seeing this, I removed the DbDataReader and used SqlCommand to update the database tables. Again, there came an exception in business layer, after some 20 minutes saying “Timeout exception”. Any idea why this is happening?

  private void ProcessDatabaseOperationsForZipCode(StringBuilder dataStringToProcess, int UserID)
    {
        int CountOfUnchangedZipCode = 0;
        string strRetiredZipCode = "";
        string strNewZipCode = "";
        dataStringToProcess.Remove(dataStringToProcess.Length - 1, 1);


        if (dataStringToProcess.Length > 0)
        {

            //TimeSpan.FromMinutes(0) - to make transaction scope as infinite.
            using (TransactionScope transaction = TransactionScopeFactory.GetTransactionScope(TimeSpan.FromMinutes(0)))
            {


                SqlConnection mySqlConnection = new SqlConnection("data source=myServer;initial catalog=myDB; Integrated Security=SSPI;");
                SqlCommand mySqlCommand = new SqlCommand("aspInsertUSAZipCode", mySqlConnection);
                mySqlCommand.CommandType = CommandType.StoredProcedure;
                mySqlCommand.Parameters.Add("@DataRows",dataStringToProcess.ToString());
                mySqlCommand.Parameters.Add("@currDate", DateTime.Now);
                mySqlCommand.Parameters.Add("@userID", UserID);
                mySqlCommand.Parameters.Add("@CountOfUnchangedZipCode", 1000);
                mySqlCommand.CommandTimeout = 0;
                mySqlConnection.Open();
                int numberOfRows = mySqlCommand.ExecuteNonQuery();

         //Database db = DatabaseFactory.CreateDatabase();
                //DbCommand cmd = db.GetStoredProcCommand("aspInsertUSAZipCode");
                //cmd.CommandTimeout = 0;
                //db.AddInParameter(cmd, "@DataRows", DbType.String, dataStringToProcess.ToString());
                //db.AddInParameter(cmd, "currDate", DbType.DateTime, DateTime.Now);
                //db.AddInParameter(cmd, "userID", DbType.Int32, UserID);
                //db.AddOutParameter(cmd, "CountOfUnchangedZipCode", DbType.String, 1000);


                //using (DbDataReader rdrUpgradeTypes = (DbDataReader)db.ExecuteReader(cmd))
                //{
                //    //while (rdrUpgradeTypes.Read())
                //    //{
                //    //    if (!String.IsNullOrEmpty(Utility.GetString(rdrUpgradeTypes, "NewZipCode")))
                //    //    {
                //    //        strNewZipCode = strNewZipCode + "," + Utility.GetString(rdrUpgradeTypes, "NewZipCode");
                //    //    }
                //    //}
                //}


                transaction.Complete();

            }
        }


    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T07:53:59+00:00Added an answer on May 23, 2026 at 7:53 am

    Thanks Oded for patiently answering my questions. My problem got resolved when I splitted the huge database operations into small batches (after configuring MSDTC).

    During Large Database operations, insufficient memory error may come. But this error may not be visible if it is inside a Transaction.

    1) Remove transaction and see if “Insufficient Memory” exception is available.

    2) Breakdown large database operations into small batches to remove the “Insufficient Memory” exception

    3) Configure MSDTC in app tier and database

    4) Ensure that WCF does not time out abruptly. It should have enough time based on database operations.

    5) Observe the behavior when the database server is restarted (This is last option)

    Some useful information available in

    There is insufficient system memory in resource pool 'default' to run this query

    MSDTC Exception during Transaction: C#

    C# ASP.Net: Exception (some times only) during long database operation

    SQL Server 2005 Error 701 – out of memory

    Some other checks:

    1) Whether the windows account under which the database engine is running have “Lock pages in memory permission”?

    2) Chek SQL Sever service pack version.

    3) Check size of virtual memory paging file

    4) Check max server memory

    5) Determining MemToLeave Settings

    6) “SQL Server Memory Configuration and MemToLeave”

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an asp.net mvc 2 web application that connects to a WCF web
I have an ASP.NET web application that is using forms authentication. Everything is configured
I have an ASP.net web service that I'm using for a web application which
I have an ASP.NET web application that, for whatever reason, when it is deployed
We have a asp.net 2.0 web application that is running on IIS7. It is
Suppose you have two seperate ASP.NET Web Application projects that both need to use
I am developing an ASP.NET web application that incorporates google maps. I have an
i have a couple of xml files in my asp.net web application that i
Let me share the following scenario: I have a ASP.NET intranet Web-based application that
I have an Asp.Net MVC application that works in the vs.net development web server.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.