2

我在 Windows 2008 IIS 7 上安装了 Classic ASP 2 网站。website1.com 和 website2.com。两者都从一个文件夹提供同一个网站:C:\Webs\website\

website1.com 已运营 6 年,在应用程序中可以将文件写入网络共享;\wdc\SharedFiles\assets\docs\ 设置了所有适当的权限,因为它多年来一直在读取和写入文件。

我最近添加了 website2.com。该网站从同一个目录中提供服务。我需要它能够写入同一个共享。问题是,website2.com 得到“写入文件失败”。和“权限被拒绝”错误。

这怎么可能?

我什至模拟了一个简单的测试。同样的错误。:

  Dim fso, objFile
  Set fso=Server.CreateObject("Scripting.FileSystemObject")
  Set objFile=fso.CreateTextFile("\\wdc\SharedFiles\assets\docs\test.txt")
  objFile.WriteLine("hello this is test")
  objFile.Close
  Set objFile=Nothing
  Set fso=Nothing

有任何想法吗?我正在拔头发。

4

2 回答 2

2

这是我自己想出来的。所以其他人可以受益,这里是:

  1. 在 IIS 中转到网站 (website2.com) 节点,然后选择“身份验证”。
  2. 确保启用“匿名身份验证”并将其设置为用户。
  3. 然后使用资源管理器授予该用户对共享的读写访问权限。
于 2012-10-19T17:46:45.440 回答
-1

不确定这是否会有所作为。实际上,我的代码中唯一的区别是我使用 server.mapPath 来指定路径。

path = Server.MapPath ("\")
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.CreateTextFile(path & "\" & txtFileName, 2) '2 = for Writing
f.Write(txtFileContents)
f.close
set f=nothing
于 2013-03-17T22:02:14.143 回答