简体   繁体   English

如何将文件上传到 IIS 虚拟目录?

[英]How to upload files to IIS Virtual Directory?

I'm writing a .NET application that needs to upload files.我正在编写一个需要上传文件的 .NET 应用程序。 I have presentation, service and data layers.我有表示层、服务层和数据层。 Files get submitted in the Presentation layer (MVC), and then saved by the Data layer.文件在表示层 (MVC) 中提交,然后由数据层保存。 Currently I'm saving files to the file system - C:\SomeDirectory, but I need to save them within the virtual directory in IIS which is managed by Plesk.目前我正在将文件保存到文件系统 - C:\SomeDirectory,但我需要将它们保存在由 Plesk 管理的 IIS 的虚拟目录中。 Did anybody come across any resources explaining how to save files to the virtual directory in IIS?有没有人遇到过任何解释如何将文件保存到 IIS 中的虚拟目录的资源?

Should I be uploading files to virtual directory at all?我应该将文件上传到虚拟目录吗?

Thank you!谢谢!

There isn't anything wrong with saving to a virtual directory as such, but it isn't really meant for that.这样保存到虚拟目录没有任何问题,但这并不是真正的意思。 The best way of saving is to try to get the absolute path of the virtual directory (if outside your site root) if at all possible.最好的保存方法是尽可能获取虚拟目录的绝对路径(如果在您的站点根目录之外)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM