473,503 Members | 1,674 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

The process cannot access the file

I get this error while reading my config file but it is only occasionally
and not all the time. I'm not sure why its happening. Does anyone know what
could be going wrong? Thanks.

[28/03/2006 14:52:06] The process cannot access the file 'C:\GCC Business
Layer\GCCBL.config' because it is being used by another process. - at
System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess
access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize,
FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean
bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode)
at GCCBL.CoolFusion.ReadConfig(String myValue)
************************************************** ************************

My Code :

System.IO.FileStream fsReadXml = new System.IO.FileStream

(System.AppDomain.CurrentDomain.BaseDirectory + "GCCBL.config",
System.IO.FileMode.Open);
// Create an XmlTextReader to read the file.

System.Xml.XmlTextReader myXmlReader =

new System.Xml.XmlTextReader(fsReadXml);

// Read the XML document into the DataSet.

DataSet myDataSet = new DataSet();

myDataSet.ReadXml(myXmlReader);

// Close the XmlTextReader

myXmlReader.Close();

fsReadXml.Dispose();
Mar 29 '06 #1
2 7653
Nobody has any idea?
"John" <jh******@msn.com> wrote in message
news:eT**************@TK2MSFTNGP11.phx.gbl...
I get this error while reading my config file but it is only occasionally
and not all the time. I'm not sure why its happening. Does anyone know what
could be going wrong? Thanks.

[28/03/2006 14:52:06] The process cannot access the file 'C:\GCC Business
Layer\GCCBL.config' because it is being used by another process. - at
System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess
access, Int32 rights, Boolean useRights, FileShare share, Int32
bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String
msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode)
at GCCBL.CoolFusion.ReadConfig(String myValue)

************************************************** ************************

My Code :

System.IO.FileStream fsReadXml = new System.IO.FileStream

(System.AppDomain.CurrentDomain.BaseDirectory + "GCCBL.config",
System.IO.FileMode.Open);
// Create an XmlTextReader to read the file.

System.Xml.XmlTextReader myXmlReader =

new System.Xml.XmlTextReader(fsReadXml);

// Read the XML document into the DataSet.

DataSet myDataSet = new DataSet();

myDataSet.ReadXml(myXmlReader);

// Close the XmlTextReader

myXmlReader.Close();

fsReadXml.Dispose();

Apr 4 '06 #2
Change

(System.AppDomain.CurrentDomain.BaseDirectory + "GCCBL.config",
System.IO.FileMode.Open);
to

(System.AppDomain.CurrentDomain.BaseDirectory + "GCCBL.config",
System.IO.FileMode.Open, System.IO.FileAccess.Read);

By default it is opening read/write exclusive use.

Jim Hughes

"John" <jh******@msn.com> wrote in message
news:eT**************@TK2MSFTNGP11.phx.gbl...
I get this error while reading my config file but it is only occasionally
and not all the time. I'm not sure why its happening. Does anyone know what
could be going wrong? Thanks.

[28/03/2006 14:52:06] The process cannot access the file 'C:\GCC Business
Layer\GCCBL.config' because it is being used by another process. - at
System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess
access, Int32 rights, Boolean useRights, FileShare share, Int32
bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String
msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode)
at GCCBL.CoolFusion.ReadConfig(String myValue)

************************************************** ************************

My Code :

System.IO.FileStream fsReadXml = new System.IO.FileStream

(System.AppDomain.CurrentDomain.BaseDirectory + "GCCBL.config",
System.IO.FileMode.Open);
// Create an XmlTextReader to read the file.

System.Xml.XmlTextReader myXmlReader =

new System.Xml.XmlTextReader(fsReadXml);

// Read the XML document into the DataSet.

DataSet myDataSet = new DataSet();

myDataSet.ReadXml(myXmlReader);

// Close the XmlTextReader

myXmlReader.Close();

fsReadXml.Dispose();

Apr 5 '06 #3

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

Similar topics

9
715
by: Paul | last post by:
Hi, VB.NET is saying the file I am creating is in use by another process and won't complete its task of moving the file to the specified destination folder. Here is my code (the main bit...
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:...
3
34466
by: trellow | last post by:
Hello, I am writing an application that needs to read a file that is already open by another process for writing. When I do the following: FileStream fs = new FileStream(fileName,...
2
7753
by: Raed Sawalha | last post by:
Hello , I have windows service which do listening to specified directory using FileSystemWatcher , on Created Event and Get all the files in the directory using Directory.GetFiles function then...
3
3770
by: guoqi zheng | last post by:
Dear sir, There is an import tool on my web application, user can upload Ms Access file, the file is saved at a temp folder on the server. After the import is finished, for security reason, I...
0
3460
by: Sin | last post by:
> Xxxxx : error PRJ0008 : Could not delete file 'd:\xxxxxxx.dll'. > Make sure that the file is not open by another process and is not write-protected. > > LINK : fatal error LNK1168: cannot open...
5
8703
by: ZWeng | last post by:
I created a windows service using FileSystemWatcher to moniter a folder for file drops. The service uses FileStream and StreamReader to read and process the file. After it is done, the file is...
0
1767
by: imranabdulaziz | last post by:
Dear All, I am making web application using Asp.net C#(Visual Studio2005). And Sql server 2005 as a back End I generated local mode report but as there was no printing option available . I assign...
0
2948
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...
4
2865
by: =?Utf-8?B?VkIgSm9ubmll?= | last post by:
I am at my witless end here, please help! I have an ASP.Net aspx web page, hosted on Windows Server 2003, that receives a query string with the path to an autocad drawing file selected from a...
0
7273
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
7322
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...
0
7451
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
5572
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,...
1
5000
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4667
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...
0
3150
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1501
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
731
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.