简体   繁体   English

当路径具有IP地址时,为什么新的FileStream在REST服务中出现访问冲突?

[英]Why does new FileStream get access violation in REST service when path has IP Address?

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? 当完整文件名类似于“ \\\\ 52.1.1.1 \\ d $ \\ temp \\ file.bmp”并且所有人都可以访问该文件夹时?

If the file is just "d:\\temp\\file.bmp", the FileStream can read it. 如果文件只是“ d:\\ temp \\ file.bmp”,则FileStream可以读取它。 There is something about the IP address part. 关于IP地址部分。

The language is Oxygene, but I'm not sure why that would make a difference. 语言是Oxygene,但我不确定为什么会有所作为。 But it IS .Net. 但是它是.Net。 FWIW. FWIW。

Guessing a lot here, but: 在这里猜了很多,但是:

I guess your REST service is running in a webserver, like IIS? 我猜您的REST服务正在像IIS这样的网络服务器中运行吗? By default, Windows services run as the LocalService account . 默认情况下,Windows服务以LocalService帐户运行。 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. " . 您说:“每个人都可以访问该文件夹”,但是与普遍的看法相反,匿名登录的任何人(即他们未通过身份验证的任何人)都不会被包括在EVERYONE组中。

(and why does EVERYONE have access to d$ - an administrative share, anyway?). (以及为什么所有人都可以访问d$ - 行政共享?)。

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. 您的服务没有访问权限,您需要使它明确地将一些凭据传递给共享,或者作为可访问共享的凭据帐户在IIS应用程序池中运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM