windows - 从 ColdFusion 访问映射的网络驱动器

标签 windows networking file coldfusion

我在访问 ColdFusion 中的映射驱动器时遇到问题。我将 \\server\files\sharing 映射到 z:\。如果我运行这段代码,它会说该目录存在于完整路径中,但不存在于映射路径中:

<cfscript>
  fullPath = "\\server\files\sharing\reports";
  mappedPath = "z:\reports";

  WriteOutput("fullPath exists: #DirectoryExists(fullPath)#<br/>"); //YES
  WriteOutput("mappedPath exists: #DirectoryExists(mappedPath)#");  //NO
</cfscript>

我进行了一些谷歌搜索,发现一些人遇到了同样的问题,但解决方案始终是使用完整路径。 ColdFusion 无法查看或访问映射的驱动器是否有原因?如果是这样,是否有任何解决方法(可能是系统调用以获取映射驱动器的完整路径)?

最佳答案

ColdFusion 无法访问映射驱动器的原因是因为它在 Windows 中作为服务运行。

A service (or any process that is running in a different security context) that must access a remote resource should use the Universal Naming Convention (UNC) name to access the resource.

这是从以下知识库文章中提取的: http://support.microsoft.com/kb/180362

您可以将服务更改为以映射了驱动器的个人用户身份运行(我还没有检查这是否有效,但它可能),但您应该使用 UNC 路径而不是映射的驱动器.

关于windows - 从 ColdFusion 访问映射的网络驱动器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2885303/

相关文章:

python - 将变量传递给需要引号的外部程序

c - 如何使用 netfilter 内核模块从 sk_buff 中读取数据?

file - Groovy 从列表中删除特定文件

c++ - 如何查找输入文件的大小

python - 使用通配符搜索文件

windows - 使用 powershell 设置新的 smb 共享时出错

windows - 获取设备的连接端口号和集线器号

c++ - 串行通信 C++ ReadFile()

linux - 我无法通过 HTTP POST 请求将 XML 数据从特定客户端发送到特定服务器。我该如何调试?

java - 如何使用Android手机获取系统的IP地址?