简体   繁体   English

我无法从C#访问unc路径。 获取访问权限被拒绝

[英]I can't access unc path from C#. Getting access is denied

I'm using Windows Server 2008 and IIS 7.5 I'm trying to access a file this way: \\server\\C$\\temp\\testFile.log from C# code running on another server. 我正在使用Windows Server 2008和IIS 7.5我试图以这种方式访问​​文件:\\ server \\ C $ \\ temp \\ testFile.log来自另一台服务器上运行的C#代码。

My username is an admin on both servers. 我的用户名是两台服务器上的管理员。 The code is running under that account. 代码在该帐户下运行。 The temp folder has been set to full rights for (my user) and ASP.NET. 临时文件夹已设置为(我的用户)和ASP.NET的完全权限。

Why can't I access it? 为什么我不能访问它?

I can't do a shared folder; 我不能做共享文件夹; against the rules. 违反规则。 I am already running under full account; 我已经在完全帐户下运行; therefore, I don't need to do impersonation, right? 因此,我不需要冒充,对吧?

Had this very same problem a while ago. 刚才有同样的问题。

For your debug process to run with full Admin access, you'd have to open Visual Studio with full admin access. 要使调试过程以完全管理员权限运行,您必须以完全管理员权限打开Visual Studio。

In production, have your process "Run As Administrator". 在生产中,让您的流程“以管理员身份运行”。

If you do not do any of the above, you will have to implement impersonation. 如果您不执行上述任何操作,则必须实施模拟。

Is this a web app? 这是一个网络应用程序? Are you sure the app is impersonating your account? 您确定该应用是否冒充您的帐户吗? Is anonymous access set to true in IIS? IIS中的匿名访问是否设置为true?

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

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