Question: I have a WCF web service that I am hosting in IIS (actually running within the Visual Studio web host i.e. Cassini).

I have a file that I have to access in the root of the web directory from the service, and am having trouble figuring out the user identity that the service accesses the directory as. I've given permission to ASPNET, NETWORK SERVICE, and IUSR, but none of these seem to work.

Anyone know what the user is that a WCF service runs as when it's hosted within IIS?

MORE INFO:

Indeed, the WCF service is running as me (my windows account), but for whatever reason, it still cannot open a file in its root directory. The file failed with "Access is Denied". I've given "Everyone" Full Control of the folder, and it doesn't seem to matter.

Answer: 
You can also do this without the buffer. In unix based systems it is easy:

```
system("stty raw -echo") #=> Raw mode, no echo
char = STDIN.getc
system("stty -raw echo") #=> Reset terminal mode
puts char

```

This will wait for a key to be pressed and return the char code. No need to press .

Put the `char = STDIN.getc` into a loop and you've got it!

If you are on windows, according to The Ruby Way, you need to either write an extension in C or use this little trick (although this was written in 2001, so there might be a better way)

```
require 'Win32API'
char = Win32API.new('crtdll','_getch', [], 'L').Call

```

Here is my reference: [great book, if you don't own it you should](http://books.google.com/books?id=ows9jTsyaaEC&pg=PA222&lpg=PA222&dq=ruby%20wait%20for%20keyboard&source=bl&ots=ilSHDQugBk&sig=E9qcsVHpqNEl2CoIFggQewgN0iw&hl=en&ei=9r5FTZncBITogQevr-DNAQ&sa=X&oi=book_result&ct=result&resnum=7&ved=0CEcQ6AEwBg#v=onepage&q&f=false)
You may also want to investigate the 'io/wait' library for Ruby which provides the `ready?` method to all IO objects. I haven't tested your situation specifically, but am using it in a socket based library I'm working on. In your case, provided STDIN is just a standard IO object, you could probably quit the moment `ready?` returns a non-nil result, unless you're interested in finding out what key was actually pressed. This functionality can be had through `require 'io/wait'`, which is part of the Ruby standard library. I am not certain that it works on all environments, but it's worth a try. Rdocs: <http://ruby-doc.org/stdlib/libdoc/io/wait/rdoc/>