Anybody meet the question about simple file read/write?thanks

À

ÀÏÓà

i just use the following simple code for test,

when the code line run to flush()/close(),the simple web process will often
down ! i check the web server event log ,the "sc-status sc-substatus
sc-win32-status "=500 0 0 ,nothing detail more.

or the web browser often says"occupied by another process" when first
line,anybody meet this? thanks .



private void Button1_Click(object sender, System.EventArgs e)
{

FileStream fs = new
FileStream(@"C:\Inetpub\wwwroot\\chart\9.txt",FileMode.Create,FileAccess.Wri
te,FileShare.None );
//FileStream fs = new
FileStream(@"C:\Inetpub\wwwroot\\chart\7.txt",FileMode.Create,FileAccess.Wri
te);
StreamWriter writer=new StreamWriter(fs,Encoding.GetEncoding("GB18030"));

writer.WriteLine("...");
Response.Write("");

try
{
writer.Flush();
writer.Close();
fs.Close();
}
catch(Exception e2)
{
Response.Write(e2.Message);

}
}
 

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top