ApplicationPoolIdentity 用户无法修改 Windows Server 2008 中共享文件夹中的文件 [英] ApplicationPoolIdentity user cannot modify files in shared folder in Windows Server 2008

查看:28
本文介绍了ApplicationPoolIdentity 用户无法修改 Windows Server 2008 中共享文件夹中的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建目录,并将文件写入我的 Web 应用程序中的共享文件夹,该应用程序托管在 Windows Server 2008 上.我正在运行具有 ApplicationPoolIdentity 标识的应用程序池.

到目前为止,为了让您了解我的设置.我已将 Web 应用程序根目录的根权限设置为两个不同的用户:IUSR"和IIS APPPOOLMYPOOL".我使用名称MYPOOL"作为我的应用程序池的名称,因此很容易引用.

应用程序无法修改和写入共享文件夹.我右键单击要在其中创建目录和写入的共享文件夹,然后单击安全"选项卡.然后我点击编辑".在对象下,我检查了计算机".然后在 LOCATION 下,我尝试了运行我的 Web 应用程序的机器/服务器.我无法在用户下找到我的MYPOOL"用户.我试图按照这个链接,但它不是很完整.我不知道该使用哪个用户.我继续收到 System.IO 异常,因为它没有权限.一旦我知道要使用哪个用户,我将不得不授予ExportPath"目录的修改"权限.

http://grekai.wordpress.com/2011/05/23/permissions-for-shared-folder-for-iis-7-application-pool-identity-across-domain/

为了快速测试,我制作了一个名为 FilePermissionsTest.aspx 的虚拟页面,并在我的 Page_Load 事件后面的代码中放入了一些编写文件的代码来创建目录并编写文件.但我还没有走得足够远来测试它.

...

检查文件_File_Permissions_Test.txt"是否写入<%Response.Write(Data.ConfigurationHelper.ValueFromConfiguration("ExportPath", Nothing))%></div>

...

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) 处理 Me.LoadDim exportPath As String = Data.ConfigurationHelper.ValueFromConfiguration("ExportPath", Nothing)如果 exportPath = String.Empty 则返回将 exportDirectory 调暗为 DirectoryInfo = Directory.CreateDirectory(exportPath)Dim writer As StreamWriter = File.CreateText(Path.Combine(exportDirectory.FullName, "_File_Permissions_Test.txt"))writer.WriteLine("测试..." + DateTime.Now().ToString)writer.Flush()writer.Close()结束子

解决方案

正如我在帖子中所写:GreKai.WordPress.com您应该输入计算机名称而不是 ApplicationPoolIdentity.那是你的问题.试试吧!它应该可以工作.

步骤如下:

转到共享文件夹->右键单击->属性->安全性->编辑->添加(到目前为止)->选择对象类型->检查计算机->现在输入应用程序所在的计算机名称正在工作,您发布应用程序的地方.

I am creating directories, and writing files to a shared folder within my web application that is being hosted on Windows Server 2008. I am running the application pool with an identity of ApplicationPoolIdentity.

To give you an idea of my setup so far.. I've set permissions to the root of my web application root directory to two different users: "IUSR" and "IIS APPPOOLMYPOOL". I'm using the name "MYPOOL" as the name of my application pool, so it's easy to reference.

The application is unable to modify and write to a shared folder. I right clicked the shared folder that I'm creating directories in and writing to, and clicked on the "Security" tab. Then I clicked "Edit". Under objects, I checked "Computer". Then under LOCATION, I've tried the machine/server running my web application. I wasn't able to find my "MYPOOL" user however under the users. I tried to follow this link, but it wasn't very complete. I don't know which user to use. I continue to get a System.IO exception because it doesn't have permissions. Once I know which user to use, I will have to give "Modify" permissions to the "ExportPath" directory.

http://grekai.wordpress.com/2011/05/23/permissions-for-shared-folder-for-iis-7-application-pool-identity-across-domain/

For a quick test, I made a dummy page called FilePermissionsTest.aspx, and put some code to write a file to create a directory and write a file in my Page_Load event of the code behind. But I haven't gotten far enough to test it.

...

<div>
Check to see if the file "_File_Permissions_Test.txt" was written to <% Response.Write(Data.ConfigurationHelper.ValueFromConfiguration("ExportPath", Nothing))%> 
</div>

...

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    Dim exportPath As String = Data.ConfigurationHelper.ValueFromConfiguration("ExportPath", Nothing)
    If exportPath = String.Empty Then Return
    Dim exportDirectory As DirectoryInfo = Directory.CreateDirectory(exportPath)

    Dim writer As StreamWriter = File.CreateText(Path.Combine(exportDirectory.FullName, "_File_Permissions_Test.txt"))
    writer.WriteLine("TESTING... " + DateTime.Now().ToString)
    writer.Flush()
    writer.Close()

End Sub

解决方案

as I've written at my post : GreKai.WordPress.com You should have entered the computer name and not the ApplicationPoolIdentity. That was your problem.Try it out ! It should work.

The steps are :

Go to the Shared Folder –> right click –> properties -> security –>edit –> add (so far as usual ) -> choose object types –> check on computers –> now enter the computer name where your application is working from , where you published your application.

这篇关于ApplicationPoolIdentity 用户无法修改 Windows Server 2008 中共享文件夹中的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆