使用asp.net上传映射驱动器中的文件
我有两台服务器。应用服务器和文件服务器。我需要将文件直接上传到文件服务器。到目前为止,我所做的是,当我上传时,我收到“未知的用户名和错误密码错误”。所以我在文件中创建了用户名和密码服务器就像应用程序服务器中的那样(IUSR_帐户。与应用程序服务器中完全相同)。 现在我收到“System.UnauthorizedAccessException:访问路径 \xxx\xx... 被拒绝”。然后我向网络服务用户授予文件服务器共享文件夹的完全权限。我仍然收到 UnauthorizedAccessException。其一,应用程序池是以网络用户的身份运行的。需要帮助。 提前致谢...
I have two servers. Application server and File server. I need to upload files directly to File server.so far what i have done is, when i upload i received "unknown user name and bad password error" .so i created an user name and password in file server like in the Application server (IUSR_ account. exact like in the application server).
Now i receive "System.UnauthorizedAccessException: Access to the path \xxx\xx... is denied".Then i granted the network service user as full permission in File server shared folder. still i get the UnauthorizedAccessException. And one more, the application pool is running under the identity of network user. Help needed.
Thanks in advance...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这些机器属于同一域吗?在这种情况下,您可以授予应用服务器的机器帐户(称为 machinename$)访问文件服务器的权限。然后,您在“网络服务”帐户下运行应用程序服务器应用程序池。您还必须使用完整的 unc 路径 (
\\server\share\directory
) 访问文件服务器,因为映射驱动器与特定用户绑定。如果您不在域环境中,则需要添加代码,以便应用服务器在附加网络共享时登录到文件服务器。在交互式登录时,在客户端和服务器上使用相同的用户名/密码对会产生神奇的效果,但对于服务而言则不然。
Are the machines part of the same domain? In that case you give the machine account (called machinename$) of the app server access to the file server. Then you run the app server app pool under the "network service" account. You also have to access the file server with a complete unc path (
\\server\share\directory
) as mapped drives are tied to a specific user.If you're not in a domain environment you need to add code so that the app server logs on to the file server when attaching the network share. Having the same username/password pair on both the client and server is something that works magically when logging on interactively, but for services that is not an option.