问题描述
我正在创建目录,并将文件写入我在Windows Server 2008上托管的Web应用程序中的共享文件夹。我正在运行具有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.
为了让您了解我到目前为止的设置..我已将我的Web应用程序根目录的根目录权限设置为两个不同的用户:IUSR和IIS APPPOOL \ MYYOOL。我使用名称MYPOOL作为我的应用程序池的名称,因此很容易引用。
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 APPPOOL\MYPOOL". I'm using the name "MYPOOL" as the name of my application pool, so it's easy to reference.
应用程序无法修改和写入共享文件夹。我右键单击了我正在创建目录并写入的共享文件夹,然后单击安全选项卡。然后我点击了编辑。在对象下,我检查了计算机。然后在LOCATION下,我尝试了运行我的Web应用程序的机器/服务器。然而,我无法在用户下找到我的MYPOOL用户。我试着按照这个链接,但它不是很完整。我不知道使用哪个用户。我继续得到System.IO异常,因为它没有权限。一旦我知道要使用哪个用户,我就必须给ExportPath目录赋予修改权限。
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.
为了进行快速测试,我创建了一个名为FilePermissionsTest.aspx的虚拟页面,并编写了一些代码来编写一个文件来创建一个目录,并在我的Page_Load事件中编写一个文件。但是我还没有足够的测试它。
...
<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
推荐答案
因为我写在我的帖子:
您应该输入计算机名称而不是A pplicationPoolIdentity。那是你的问题。试试吧!它应该有效。
as I've written at my post :GreKai.WordPress.comYou should have entered the computer name and not the ApplicationPoolIdentity. That was your problem.Try it out ! It should work.
步骤如下:
转到共享文件夹 - >右键单击 - >属性 - >安全 - >编辑 - >添加(通常) - >选择对象类型 - >检查计算机 - >现在输入您的应用程序所在的计算机名称,以及您发布应用程序的位置。
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中共享文件夹中的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!