如何映射远程服务器中的路径
我必须管理文件服务器中的附件。所以我将文件服务器映射到本地e:驱动程序,并在我的程序中直接指向它。它在我的工作机器中工作正常,但报告无法在我放置代码的应用程序服务器中找到路径。有谁知道如何映射远程服务器中的路径?这是一个.net项目,我使用c#。提前致谢。
I have to manage the attachment in a file server. So I mapped the file server to local e: driver, and point to it directly in my program. It works fine in my working machine, but reports can not find path in the application server where I put my code on. Does anyone knows how to map a path in remote server? It's a .net project, and I use c#. Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
驱动器映射基于每个用户。我的猜测是,您在开发 ASP.NET 应用程序时正在使用内置开发服务器。
该服务器在您自己的帐户下运行,这就是为什么您可以看到与您的帐户关联的驱动器映射。但是,当在 IIS 中运行时,它会在另一个用户下运行(很可能是运行 ASP.NET 应用程序的 ASP.NET 本地用户,除非另有指定)。
也就是说,您应该使用 UNC 路径来查找文件,而不是依赖于映射驱动器;这些名称将始终相同。
即使您为 ASP.NET 用户设置了驱动器映射,如果您模拟该用户,也会遇到问题,因此最好坚持使用 UNC 路径。
Drive mappings are on a per-user basis. My guess is that you are using the built-in development server when developing your ASP.NET application.
This server runs under your own account, which is why you can see drive mappings associated with your account. However, when run in IIS, it runs under another user (more than likely the ASP.NET local user for running ASP.NET applications, unless specified otherwise).
That said, you should be using UNC paths to find your files and not rely on mapped drives; these names will always be the same.
Even if you set the drive mappings up for the ASP.NET user, you have a problem if you impersonate the user, so best to stick with the UNC paths.