0

Why does this get an access violation:

     using fs := new FileStream( fullFilename, FileMode.Open, System.IO.FileAccess.Read )

when the fullfilename is like "\\52.1.1.1\d$\temp\file.bmp" and EVERYONE has access to the folder?

If the file is just "d:\temp\file.bmp", the FileStream can read it. There is something about the IP address part.

The language is Oxygene, but I'm not sure why that would make a difference. But it IS .Net. FWIW.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
  • I think some additional background info is needed to help answer your question... Are you using Visual Basic? Which version? Are you able to read other, local files (not on the network share?) – jeyoor Jul 13 '16 at 20:48
  • 1
    Please add the tag of the language you are using – svn Jul 13 '16 at 20:50

1 Answers1

0

Guessing a lot here, but:

I guess your REST service is running in a webserver, like IIS? By default, Windows services run as the LocalService account. This "presents anonymous credentials on the network".

"EVERYONE has access to the folder", you say, but "Contrary to popular belief, anyone who is logged in anonymously—that is, they did not authenticate—will NOT be included in the EVERYONE group.".

(and why does EVERYONE have access to d$ - an administrative share, anyway?).

Your service has no access, and you need to make it pass some credentials to the share explicitly, or run in an IIS application pool as a credentialed account which can access the share.

TessellatingHeckler
  • 27,511
  • 4
  • 48
  • 87