473,508 Members | 2,400 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Process used by another

Hi,

i have a Web application and i get this error:

The process cannot access the file
"c:\inetpub\wwwroot\dotnet\Soluciones\Calculations \PhoneTariffs\Errors\Log.txt" because it is being used by another

The code that generates this error is the following:

Directory.CreateDirectory("c:\inetpub\wwwroot\Erro r");
File.Create("c:\inetpub\wwwroot\Error\log.txt");

System.IO.StreamWriter StreamLog=new
System.IO.StreamWriter("c:\inetpub\wwwroot\Error\l og.txt");
StreamLog.Write(e.Message);
StreamLog.Close();

How could avoid that error?.
--
Thanks a lot
Kind Regards.
Josema
Nov 17 '05 #1
3 5302

"Josema" <Je******@ocu.org> wrote in message
news:C8**********************************@microsof t.com...
Hi,

i have a Web application and i get this error:

The process cannot access the file
"c:\inetpub\wwwroot\dotnet\Soluciones\Calculations \PhoneTariffs\Errors\Log.txt"
because it is being used by another

The code that generates this error is the following:

Directory.CreateDirectory("c:\inetpub\wwwroot\Erro r");
File.Create("c:\inetpub\wwwroot\Error\log.txt");

System.IO.StreamWriter StreamLog=new
System.IO.StreamWriter("c:\inetpub\wwwroot\Error\l og.txt");
StreamLog.Write(e.Message);
StreamLog.Close();

How could avoid that error?.
--
Thanks a lot
Kind Regards.
Josema


You open the same file two times here.
There is no need for - File.Create("c:\inetpub\wwwroot\Error\log.txt");

Willy.

Nov 17 '05 #2
In message <OX**************@TK2MSFTNGP14.phx.gbl>, "Willy Denoyette
[MVP]" <wi*************@telenet.be> writes

"Josema" <Je******@ocu.org> wrote in message
news:C8**********************************@microso ft.com...
Hi,

i have a Web application and i get this error:

The process cannot access the file

"c:\inetpub\wwwroot\dotnet\Soluciones\Calculatio ns\PhoneTariffs\Errors\
Log.txt"
because it is being used by another

The code that generates this error is the following:

Directory.CreateDirectory("c:\inetpub\wwwroot\Erro r");
File.Create("c:\inetpub\wwwroot\Error\log.txt");

System.IO.StreamWriter StreamLog=new
System.IO.StreamWriter("c:\inetpub\wwwroot\Error\l og.txt");
StreamLog.Write(e.Message);
StreamLog.Close();
You open the same file two times here.
There is no need for - File.Create("c:\inetpub\wwwroot\Error\log.txt");


And the StreamWriter created by that line of code is still open, which
is probably what is locking the file.

--
Steve Walker
Nov 17 '05 #3

"Steve Walker" <st***@otolith.demon.co.uk> wrote in message
news:o3**************@otolith.demon.co.uk...
In message <OX**************@TK2MSFTNGP14.phx.gbl>, "Willy Denoyette
[MVP]" <wi*************@telenet.be> writes

"Josema" <Je******@ocu.org> wrote in message
news:C8**********************************@micros oft.com...
Hi,

i have a Web application and i get this error:

The process cannot access the file
"c:\inetpub\wwwroot\dotnet\Soluciones\Calculations \PhoneTariffs\Errors\
Log.txt"
because it is being used by another

The code that generates this error is the following:

Directory.CreateDirectory("c:\inetpub\wwwroot\Erro r");
File.Create("c:\inetpub\wwwroot\Error\log.txt");

System.IO.StreamWriter StreamLog=new
System.IO.StreamWriter("c:\inetpub\wwwroot\Error\l og.txt");
StreamLog.Write(e.Message);
StreamLog.Close();

You open the same file two times here.
There is no need for - File.Create("c:\inetpub\wwwroot\Error\log.txt");


And the StreamWriter created by that line of code is still open, which is
probably what is locking the file.

--
Steve Walker


Exactly!

Willy.
Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

77
4503
by: Charles Law | last post by:
Hi guys I have a time critical process, running on a worker thread. By "time critical", I mean that certain parts of the process must be completed in a specific time frame. The time when the...
4
8289
by: Mountain Bikn' Guy | last post by:
I am having serious problems with the following IDE bug: Could not write to output file 'x.dll' -- 'The process cannot access the file because it is being used by another process. ' and BUG:...
4
13222
by: Earth Worm Jim | last post by:
I am using VS.Net 2003 on Windows 2003 Server (standard edition) and I am getting "The process cannot access the file because it is being used by another process" on DLL's in a VS.Net solution. ...
10
14399
by: Sorin Dolha [MCSD .NET] | last post by:
I would like to start a process from C# code as another user. The C# code is executed as the ASPNET user because it relies in a Web Page class, and I would like that the process will run as another...
8
26701
by: Gabe Moothart | last post by:
Hi, I'm writing a windows service which interacts with a separate process. Basically, it calls a process which creates a file, and then my service reads that file. The problem is, the external...
4
27084
by: funkmusha | last post by:
I am trying to read a log file using vb.net. I get an error stating "The process cannot access the file 'C:\test.log' because it is being used by another process." Below is a sample of what I am...
0
1633
by: chris | last post by:
In VB6.0 I was using API calls for checking that a process has finished and then continue with other steps: var_process_number = Shell("wzunzip.exe -o " & """" & fld_ZIP_file_name & """" & " " &...
0
2949
nightangel
by: nightangel | last post by:
Hi dude,what i was done in my application is uploading a image file to my server using FTP, it work great when pushing a file into the server path using FTP. The problem i met now is i need to do a...
3
2201
by: =?Utf-8?B?RnJhbmsgVXJheQ==?= | last post by:
Hi all I am trying to loop a Textfile. This Textfile is located on a shared drive and it is used by another process. When I try to read it I get an exeption: The process cannot access the...
3
3322
by: gracepaul | last post by:
hi, i got an exception while i m trying to zip/unzip a database inside the serverfolder System.IO.IOException: The process cannot access the file...
0
7114
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7321
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7377
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7034
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7488
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5623
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
1
762
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
412
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.