如何使用C#从另一台服务器获取文件 [英] How to get a file from Another Server using C#

查看:399
本文介绍了如何使用C#从另一台服务器获取文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序位于一台服务器上,文件位于我的数据库服务器上,位于D:/abc/xyz.txt

如何使用c#

My Application is on one server and File is on my Database Server in D:/abc/xyz.txt
how can I access xyz.txt in my application using c#

推荐答案

取决于:如果文件夹与网络共享,那么你可以访问它。

如果不是你不能 - 这是设计阻止人们阅读他们无法访问的文件。



如果它是共享的,那么您可以通过将磁盘共享设置到该文件夹​​并对其进行处理来访问它就像一个远程磁盘驱动器(我使用我的NAS执行此操作:文件夹的永久链接显示为A:,B:,M:等等)

您也可以使用此:http://stackoverflow.com/questions/5433570/access-a-remote-directory-from- c-sharp [ ^ ]甚至FTP:http://msdn.microsoft.com/en-us/library/ms229711(v=vs.110) .aspx [ ^ ]
Depends: if the folder is shared with the network then you can access it.
If it isn't you can't - this is by design to stop people reading files that they shouldn't have access to.

If it is shared then you can access it by setting an disk share to the folder and treating it like a remote disk drive (I do this with my NAS: permanent links to folders show as A:, B:, M:, and so forth)
You can also use this: http://stackoverflow.com/questions/5433570/access-a-remote-directory-from-c-sharp[^] or even FTP: http://msdn.microsoft.com/en-us/library/ms229711(v=vs.110).aspx[^]






1.共享文件驻留在数据库服务器上的路径并提供访问你的第一台服务器。

2.主机服务,它将为你提供文件

3.将文件放入数据库(如果是小文件)并使用查询
4.将其上传到Google云端硬盘并随时随地访问它

5.只需将其从您的服务器复制到所需位置即可访问它而无需担心

6.您也可以创建FTP或上传文件到FTP
Hi,

1. Share the path where file resides at your DB server and provide access your 1st Server.
2. Host service which will provide you the file
3. Put the file into DB (if small file) and access it using query
4. Upload it to Google drive and access it any location
5. Just Copy it from your server to desire location access it without any concern
6. You can also create FTP or upload file to FTP


这篇关于如何使用C#从另一台服务器获取文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆