473,662 Members | 2,593 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C# Windows Service is locking file

JM
I have created a Windows Service which uses xml file as a data source.
The service is running on .NET 2.0 and uses LocalSystem account.

It was running fine but now it has started locking the xml file
sometimes. When I stop the service it unlocks the file.The service is
running all time. And it locks xml file sometimes not always.

I would really appreciate if anybody can guide me here.

Thanks
JM

Sep 28 '06 #1
5 4511
Seems that class that works with fike is not disposed correctly.
Do u use using approach when work with your XML?

What's the version u run - debug or server?

--
WBR,
Michael Nemtsev :: blog: http://spaces.live.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche

"JM" wrote:
I have created a Windows Service which uses xml file as a data source.
The service is running on .NET 2.0 and uses LocalSystem account.

It was running fine but now it has started locking the xml file
sometimes. When I stop the service it unlocks the file.The service is
running all time. And it locks xml file sometimes not always.

I would really appreciate if anybody can guide me here.

Thanks
JM

Sep 28 '06 #2
JM
Hi Michael,

Thanks for the quick response.

I am using "ds.ReadXml(Fil eName)" for reading xml file and then using
"ds.WriteXml(Fi leName)" for writing XML from dataset. Where ds =
dataset and FileName = name of xml file.

I am compiling Windows Service in "debug" mode only and running that
version only. Whats the "server" mode? Is it the same as "release"
mode?

I have created windows service using VS 2005 in C# using .NET Framework
2.0.

Is there any better way of reading and writing XML. Dataset is
disconnected so there should not be any problem (I may be wrong).

Any help would be appreciated.

Regards
JM

Michael Nemtsev wrote:
Seems that class that works with fike is not disposed correctly.
Do u use using approach when work with your XML?

What's the version u run - debug or server?

--
WBR,
Michael Nemtsev :: blog: http://spaces.live.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche

"JM" wrote:
I have created a Windows Service which uses xml file as a data source.
The service is running on .NET 2.0 and uses LocalSystem account.

It was running fine but now it has started locking the xml file
sometimes. When I stop the service it unlocks the file.The service is
running all time. And it locks xml file sometimes not always.

I would really appreciate if anybody can guide me here.

Thanks
JM
Sep 29 '06 #3
Try to rebuild you app in "release" mode (I mistyped with "Server" mode)
In debug CLR can prolong object GC to the end of code block, not scope, thus
your file can be open when you are trying to write into in.

--
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche


"JM" wrote:
Hi Michael,

Thanks for the quick response.

I am using "ds.ReadXml(Fil eName)" for reading xml file and then using
"ds.WriteXml(Fi leName)" for writing XML from dataset. Where ds =
dataset and FileName = name of xml file.

I am compiling Windows Service in "debug" mode only and running that
version only. Whats the "server" mode? Is it the same as "release"
mode?

I have created windows service using VS 2005 in C# using .NET Framework
2.0.

Is there any better way of reading and writing XML. Dataset is
disconnected so there should not be any problem (I may be wrong).

Any help would be appreciated.

Regards
JM

Michael Nemtsev wrote:
Seems that class that works with fike is not disposed correctly.
Do u use using approach when work with your XML?

What's the version u run - debug or server?

--
WBR,
Michael Nemtsev :: blog: http://spaces.live.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche

"JM" wrote:
I have created a Windows Service which uses xml file as a data source.
The service is running on .NET 2.0 and uses LocalSystem account.
>
It was running fine but now it has started locking the xml file
sometimes. When I stop the service it unlocks the file.The service is
running all time. And it locks xml file sometimes not always.
>
I would really appreciate if anybody can guide me here.
>
Thanks
JM
>
>

Sep 29 '06 #4
JM
Thanks for your help. I will test the app build in Release mode. I will
keep you posted about the results.

Thanks
JM

Michael Nemtsev wrote:
Try to rebuild you app in "release" mode (I mistyped with "Server" mode)
In debug CLR can prolong object GC to the end of code block, not scope, thus
your file can be open when you are trying to write into in.

--
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche


"JM" wrote:
Hi Michael,

Thanks for the quick response.

I am using "ds.ReadXml(Fil eName)" for reading xml file and then using
"ds.WriteXml(Fi leName)" for writing XML from dataset. Where ds =
dataset and FileName = name of xml file.

I am compiling Windows Service in "debug" mode only and running that
version only. Whats the "server" mode? Is it the same as "release"
mode?

I have created windows service using VS 2005 in C# using .NET Framework
2.0.

Is there any better way of reading and writing XML. Dataset is
disconnected so there should not be any problem (I may be wrong).

Any help would be appreciated.

Regards
JM

Michael Nemtsev wrote:
Seems that class that works with fike is not disposed correctly.
Do u use using approach when work with your XML?
>
What's the version u run - debug or server?
>
--
WBR,
Michael Nemtsev :: blog: http://spaces.live.com/laflour
>
"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
>
"JM" wrote:
>
I have created a Windows Service which uses xml file as a data source.
The service is running on .NET 2.0 and uses LocalSystem account.

It was running fine but now it has started locking the xml file
sometimes. When I stop the service it unlocks the file.The service is
running all time. And it locks xml file sometimes not always.

I would really appreciate if anybody can guide me here.

Thanks
JM
Sep 29 '06 #5
JM
I tried running windows service app in Release mode also. But its still
locking the file.

JM

JM wrote:
Thanks for your help. I will test the app build in Release mode. I will
keep you posted about the results.

Thanks
JM

Michael Nemtsev wrote:
Try to rebuild you app in "release" mode (I mistyped with "Server" mode)
In debug CLR can prolong object GC to the end of code block, not scope, thus
your file can be open when you are trying to write into in.

--
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche


"JM" wrote:
Hi Michael,
>
Thanks for the quick response.
>
I am using "ds.ReadXml(Fil eName)" for reading xml file and then using
"ds.WriteXml(Fi leName)" for writing XML from dataset. Where ds =
dataset and FileName = name of xml file.
>
I am compiling Windows Service in "debug" mode only and running that
version only. Whats the "server" mode? Is it the same as "release"
mode?
>
I have created windows service using VS 2005 in C# using .NET Framework
2.0.
>
Is there any better way of reading and writing XML. Dataset is
disconnected so there should not be any problem (I may be wrong).
>
Any help would be appreciated.
>
Regards
JM
>
Michael Nemtsev wrote:
>
Seems that class that works with fike is not disposed correctly.
Do u use using approach when work with your XML?

What's the version u run - debug or server?

--
WBR,
Michael Nemtsev :: blog: http://spaces.live.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche

"JM" wrote:

I have created a Windows Service which uses xml file as a data source.
The service is running on .NET 2.0 and uses LocalSystem account.
>
It was running fine but now it has started locking the xml file
sometimes. When I stop the service it unlocks the file.The service is
running all time. And it locks xml file sometimes not always.
>
I would really appreciate if anybody can guide me here.
>
Thanks
JM
>
>
>
>
Sep 30 '06 #6

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

Similar topics

6
7313
by: Pekka Niiranen | last post by:
Hi, I have used the following example from win32 extensions: -----SCRIPT STARTS---- import win32file import win32con import win32security import pywintypes
19
2723
by: Mark C. | last post by:
The company I work for has been running Access 2000 on a Windows NT server with Opportunistic Locking turned off on the server without issue for almost a year. We have just switched to a Windows 2000 file server with service pack 3 installed and are now experiencing at least 2 corruptions a day. The registry setting for Opportunistic Locking that was on the Windows NT server does not exist on the Windows 2000 server so we can not make the...
1
1579
by: Mark | last post by:
The company I work for has been running Access 2000 on a Windows NT server with Opportunistic Locking turned off on the server without issue for almost a year. We have just switched to a Windows 2000 file server with service pack 3 installed and are now experiencing at least 2 corruption's a day. The registry setting for Opportunistic Locking that was on the Windows NT server does not exist on the Windows 2000 server so we can not make the...
6
2256
by: alanknipmeyer | last post by:
Hi, I`m in the process of migrating a Access 2002 (Run in 2000 mode) from Windows 98 to Win2K Server. It is a shared resource via a file share on the 98 Server. Client systems are Win98 with the shared drive mounted and the application run via the shared drive. I have tried once before, but came across some file locking issues. I thought i had addressed these file locking issues, but it came apparent I hadn't when data started to get...
2
1588
by: JJ | last post by:
I have written a multi-threaded Windows service. I developed it in such a way that the core logic is a separate class library from the actual service project, so I could test the .DLL in a console. In the console test app, the app will run for days on end without a problem. All necessary calls are thread safe (lock). However, when plugged into the Windows service, the darn thing simply grinds to a halt i a matter of minutes. No exceptions,...
0
3163
by: Andrew Dowding | last post by:
Hi Everybody, I have been looking at problems with my Windows Forms C# application and it's little Jet 4 (Access) database for the last few days. The Windows Forms app implements a facade and implementation, data abstraction layer. But because each data adapter in the implementation layer has a connection object that opens and closes as needed, I found I got several errors from the Jet engine when there were simultaneous connections to...
1
2472
by: james | last post by:
Hi Apologies if this is the incorrect group for this post. I have a Windows Service running that populates a database and a Web Service that accesses the same SQL 2000 database. One of my tables within the database records the filenames of files within a number of folders. If a folder changes, all records for that folder are deleted and a new set of records inserted. This is achieved
0
1483
by: JM | last post by:
I am working on an application which uses xml file as a database. The application has 2 interfaces which accesses this xml file. "Windows application written in C#" and "Windows Service written in C#". Both have been developed in .NET Framework 2.0. Recently I have started getting error in Windows application that "xml file is being locked by some other process". I have debugged and find out that its my Windows Service which is locking...
9
2181
by: brendan_gallagher_2001 | last post by:
Hi I am seeing some strange behaviour on a windows (vb.net 1.1) service. Basically, what I see happening is that when the Timer1_Elapsed event fires, it attempts to execute Timer1.Stop() but takes a long time to do this. In the meantime, the Timer1_Elapsed event fires again and a new thread seems to try and also tries to execute Timer1.Stop(). Eventually, both threads manage to execute Timer1.Stop() and both threads execute the...
0
8432
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8344
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8546
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7367
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6186
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5654
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4180
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
1993
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1752
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.