bslim

Hi all,

I am writing a window service to watch a folder.

When there is a new file created , I will take the information and write an xml file to another folder.

But when I run the window service, the following error is shown

EventType clr20r3, P1 directorywatcher.exe, P2 1.0.0.0, P3 472a843d, P4 mscorlib, P5 2.0.0.0, P6 461eee3d, P7 2c63, P8 2e, P9 system.notsupportedexception, P10 NIL.

Does it mean that I cannot write xml file in window service

If yes, may I know what is the best way

Please help.

Thanks



Re: Visual C# General can I write xml file in window service

Francois Malgreve

Hi,

You can write files from a Windows Service.
Your exception message does not give much information so I can't really comment about that.
Nevertheless, at the risk of asking you something trivial, did you check that the Windows User running your Windows Service has the necessary security rights to create files and write into the output folder

To do so, right click on the output folder, click properties, click on the Security tab and check that the Windows User running the service has the necessary rights.
Note that it also need read right on the folder you read the file from.

Maybe you can give Full Permission on both folder so that you can quickly see if the problem is related to security. If it is, you can later reduce the permission to what is only necessary. Note that you might have to stop and restart the windows service to make sure that the new permissions are loaded into the service (not sure about that though, but it cost nothing to do it).

HTH

Francois Malgreve




Re: Visual C# General can I write xml file in window service

bslim

Hi ,

I had tried writing the files to the folder without any problem. Initially, I had created the folder in the network drive. But now, I try to create it in the local drive, but still giving the same problem.





Re: Visual C# General can I write xml file in window service

Francois Malgreve

So, did you check if you gave all access rights permissions to those local folders

If it works on remote folder but not on local folder it seems to be an access right problem. Please check the access rights for the user running the windows service.

Francois Malgreve