asp.net strange behaviour

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
 
C

Craig Deelsnyder

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...
 
A

Alex Grefu

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...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top