asp.net strange behaviour

  • Thread starter Thread starter Alex Grefu
  • Start date Start date
A

Alex Grefu

Hello everyone!
I have a problem that it's gonne drive me crazy...
I have an intranet web application that has an upload module. I did it, test
it and it's working on my development machine(windows xp; vs 2005; asp.net
2.0), but when I moved the completed application to the production machine
(windows 2003 server; asp.net 2.0), the upload module doesn't work anymore:
I randomly receive this error:
Cannot access a closed file. mscorlib:
I mention that on my development server is working exactly as it should. And
I carried over 30 different tests.

this is my upload code:
--> it's this portion of the code that generates the exception

string title = System.IO.Path.GetFileName(http_file.PostedFile.FileName);
string contentType = http_file.PostedFile.ContentType;
System.IO.Stream file = http_file.PostedFile.InputStream;
byte[] fileData = new byte[file.Length];
file.Read(fileData, 0, Convert.ToInt32(file.Length));
file.Close();
objFisa.AddAtachment(ID, title, contentType, fileData); //objFisa is a
custom object
 
Alex said:
Hello everyone!
I have a problem that it's gonne drive me crazy...
I have an intranet web application that has an upload module. I did it, test
it and it's working on my development machine(windows xp; vs 2005; asp.net
2.0), but when I moved the completed application to the production machine
(windows 2003 server; asp.net 2.0), the upload module doesn't work anymore:
I randomly receive this error:
Cannot access a closed file. mscorlib:
I mention that on my development server is working exactly as it should. And
I carried over 30 different tests.

this is my upload code:
--> it's this portion of the code that generates the exception

string title = System.IO.Path.GetFileName(http_file.PostedFile.FileName);
string contentType = http_file.PostedFile.ContentType;
System.IO.Stream file = http_file.PostedFile.InputStream;
byte[] fileData = new byte[file.Length];
file.Read(fileData, 0, Convert.ToInt32(file.Length));
file.Close();
objFisa.AddAtachment(ID, title, contentType, fileData); //objFisa is a
custom object

hmmm...you could try setting the 'disk buffer' setting in the config
file, if not already:

http://channel9.msdn.com/ShowPost.aspx?PostID=106570

see last reply to that post (or read the rest of it, may have some clues).

sorry i can't be much more help...
 
Thanks a lot! This solved it! I was just about ready to throw my computer
out the window. Thanks again.

Craig Deelsnyder said:
Alex said:
Hello everyone!
I have a problem that it's gonne drive me crazy...
I have an intranet web application that has an upload module. I did it,
test it and it's working on my development machine(windows xp; vs 2005;
asp.net 2.0), but when I moved the completed application to the
production machine (windows 2003 server; asp.net 2.0), the upload module
doesn't work anymore: I randomly receive this error:
Cannot access a closed file. mscorlib:
I mention that on my development server is working exactly as it should.
And I carried over 30 different tests.

this is my upload code:
--> it's this portion of the code that generates the exception

string title = System.IO.Path.GetFileName(http_file.PostedFile.FileName);
string contentType = http_file.PostedFile.ContentType;
System.IO.Stream file = http_file.PostedFile.InputStream;
byte[] fileData = new byte[file.Length];
file.Read(fileData, 0, Convert.ToInt32(file.Length));
file.Close();
objFisa.AddAtachment(ID, title, contentType, fileData); //objFisa is a
custom object

hmmm...you could try setting the 'disk buffer' setting in the config file,
if not already:

http://channel9.msdn.com/ShowPost.aspx?PostID=106570

see last reply to that post (or read the rest of it, may have some clues).

sorry i can't be much more help...
 
Back
Top