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 7927603
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T19:23:31+00:00 2026-06-03T19:23:31+00:00

I have a Web Application hosted in IIS 6 on a Windows Server 2003

  • 0

I have a Web Application hosted in IIS 6 on a Windows Server 2003 box and have to handle 2 large PDF files around 7-8mb, these files are read by the website from a network share and the bytes passed to a WCF service for saving elsewhere.

here is the code I use to read the Files:

public static byte[] ReadFile(string filePath)
{
    int count;
    int sum = 0;
    byte[] buffer;
    FileStream stream = new FileStream(filePath, FileMode.Open, FileAccess.Read);

    try
    {
        int length = (int)stream.Length;
        buffer = new byte[length];

        while ((count = stream.Read(buffer, sum, length - sum)) > 0)
            sum += count;

        return buffer;
    }
    catch (Exception)
    {
        throw;
    }
    finally
    {
        stream.Close();
        stream.Dispose();
    }
}

An error is thrown on the stream.Read() and the error is:

Insufficient system resources exist to complete the requested service

This code works in my dev environment but as soon as I post to our production environment we get this error message.
I have seen this error has surfaced a few times searching round and the worfaround for this is to use File.Move() but we can not do this as the file needs to be passed to a WCF service method.

Is there something in IIS6 that needs to be changed to allow holding 15-20mb in memory when reading file? or is there something else that needs to be configured?

Any ideas?

  • 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-06-03T19:23:34+00:00Added an answer on June 3, 2026 at 7:23 pm

    See this:

    Why I need to read file piece by piece to buffer?

    It seems you are reading the whole file, without buffering..

    buffer = new byte[length];

    Best regards.

    • 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 2.0 web site hosted on Windows Server 2008 with IIS
There is a web service application hosted On IIS 7.5. Authentication mode is Windows.
I have a .net web application which I have hosted on IIS. when I
I have a .net 4.0 web application hosted on IIS7 server. After reading this:
I have a Web application and a WCF service hosted on the same Windows
I have a web application developed in ASP.net hosted on IIS in our network(Box1).
We have an ASP Classic legacy web application , which is hosted in Windows
We have an ASP.NET web application hosted by a web farm of many instances
We have built a hosted web application, that is developed in a way that
I have a web application which is run on Windows CE's Internet Explorer. Is

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.