简体   繁体   English

允许.NET应用程序的写入权限

[英]Allow write permissions for .NET application

I've been running in circles with allowing my application to write to a folder on a shared network drive. 我一直在圈子中允许我的应用程序写入共享网络驱动器上的文件夹。

So far I have this: 到目前为止,我有这个:

FileUploadControl.SaveAs(Server.MapPath("myFolder/" + filename));

this successfully saves the file to 这成功将文件保存到

\\machineName\inetpub\wwwroot\myApp\myFolder

However, I am also trying to save the same file to a folder outside of the root folder on the path 但是,我也试图将同一文件保存到路径上根文件夹之外的文件夹中

\\machineName\myFolder

using: 使用:

FileUploadControl.SaveAs("C:\\myFolder\\" + filename);

This returns an error of "Access Denied." 这将返回错误“访问被拒绝”。 So how do I go about allowing my application to write a file to \\\\machineName\\myFolder? 那么如何允许我的应用程序将文件写入\\\\ machineName \\ myFolder? I have tried giving write permissions to IIS_IUSRS and NETWORK SERVICE to no avail. 我尝试将IIS_IUSRS和NETWORK SERVICE的写权限赋予无效。 Should I create a user with privileges to write to the network drive and then use impersonation to use that user when writing to the drive? 我应该创建一个特权来写入网络驱动器的用户,然后在写入驱动器时使用模拟来使用该用户吗? Using IIS 7 with .NET 4 application. 将IIS 7与.NET 4应用程序一起使用。

Go to your application's app pool, right click on it and choose Advanced properties . 转到应用程序的应用程序池,右键单击它,然后选择高级属性 Check the Identity value under Process model settings group. 检查“ 流程模型设置”组下的“ 标识”值。 Give this Identity permissions to write files in your folder. 授予此标识权限,以将文件写入文件夹中。

If the value is ApplcationPoolIdentity than user name is IIS APPPOOL\\app_pool_name . 如果该值为ApplcationPoolIdentity ,则用户名为IIS APPPOOL\\app_pool_name

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

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