如何在Windows环境中从其他服务器访问文件

问题描述:





我有两个不同的应用程序(A和B)部署在运行IIS 7的不同Windows服务器上。应用程序B有一些文件,文件路径存储在SQL Server 2008 db中,它们存储在上传文件夹中。

我想从应用程序A获取/获取这些文件。我想知道是否需要将上传目录设置为虚拟目录(当前没有为应用程序B指定虚拟目录)然后访问它通过http协议。 Becoz目前我通过提供一些路径(例如http://ipaddress/FirstDir/Upload/my.pdf)从应用程序A(C#)访问它,它给了我它不是一个有效的虚拟路径错误。

请建议我更好的办法。



Regds

SNI

Hi,

I have two different applications (A and B) deployed on different windows servers where IIS 7 in running. There are some file for application B for which file path is stored in SQL server 2008 db and they are stored in upload folder.
I want to get/fetch these files from application A. I would like to know whether I need to make upload directory as virtual directory (currently no virtual directory is specified for application B) and then access it through http protocol. Becoz currently I am accessing this from application A (C#) by providing some path (e.g. http://ipaddress/FirstDir/Upload/my.pdf) it gives me "it is not a valid virtual path" error.
Please suggest me the better approach to do this.

Regds
SNI

如果两台服务器位于同一局域网上,您可以在服务器B上创建网络共享,并授予应用A访问该共享的权限。

然后,您可以使用网络路径访问文件比如\\ipaddress\SharedFolderName \ ... \ my.pdf
If both servers are on the same LAN you can create a network share on server B and give app A permissions to access that share.
You could then access files using network path like "\\ipaddress\SharedFolderName\...\my.pdf"