"system lacked sufficient buffer space" on ashx handler

frosty1
frosty1 used Ask the Experts™
on
I have the following handler "myHandler,ashx"

This is hit by a windows schedule every 30 minutes. I set this up yesterdays. But over night at some stage it failed and bought down my entire website. Here is the error on my website

"An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full"

I've recycled the app pool and we are back running. But i'm wondering what are best pre-cautions i can take to stop this from occuring.

See attached code, it's not all of it but will give you an idea of what i'm doing.


public static bool Import()
       {
           DownloadXml();
           return true;
       }

       private static void DownloadXml()
       {
           string path = HttpContext.Current.Server.MapPath(ConfigHelper.GetValue("FestivalSystemsXML"));
           string url = ConfigHelper.GetValue("FestivalSystemsUrl");
           WebClient client = new WebClient();
           using (client)
           {
               client.DownloadFile(@url, @path);
           }

           // create _festivalsystemsArtist
           _festivalsystemsArtist = ReadXML();

           string thursdayPath = EventContentPath("Thursday");
           CreateContentFiles(thursdayPath, Thursday, Thursday.AddHours(28));
           string fridayPath = EventContentPath("Friday");
           CreateContentFiles(fridayPath, Friday, Friday.AddHours(28));
           string saturdayPath = EventContentPath("Saturday");
           CreateContentFiles(saturdayPath, Saturday, Saturday.AddHours(28));

           // Log Import
           //LogWriter.FestivalSystemLogs("");
       }

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
If the error raise on webclient.DownloadFile method, I think you have to change rquest buffer size.
if you are on asp.net 2.0 try changing web.config:
<httpRuntime
        maxRequestLength="10000"
        executionTimeout="3600"
        />
if you are on asp.net 3.5, or you are calling asp.net 3.5 wcf, i think you have to change on service side acting on binding none of web.config.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial