Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

Are Windows Services restricted from IO operations ?

$
0
0

Good Morning, Gurus.

I'm having a bit of a problem with converting a conventional Windows App to a Windows Service.

I have narrowed the problem down to a single (small) function as follows ...

            using (StreamWriter wrtr = new StreamWriter(ProcessPath.Replace(".exe", ".txt"))) {
                wrtr.AutoFlush = true;
                wrtr.Write(/*this.ToSerializationString()*/ "xyz");
            }

That's it; that's all there is in that function ...

Note how I have changed the original argument to the simple string "xyz" for purposes of debugging (I wanted to be certain there was nothing in that function that was causing the 'Start' Service function to quit).   Changing that makes no difference ... it still fails to start.  Consequently, I will restore the original argument and remove the debug argument.

It's important to note that eliminating the call to this function allows the 'Start' function to run to completion and the Windows Service seems to be a happy camper.

That being the case, I'm wondering if Windows Service functions are restricted from IO.    Do you happen to know one way or the other ?

thanks.

Old Guy.


Viewing all articles
Browse latest Browse all 31927

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>