简体   繁体   English

将网站文件夹之外的网络文件夹映射到网站?

[英]Map network folders outside of web site folder to web site?

I am looking for an easy way to map some pictures on a server outside of the web folder HIERARCHY. 我正在寻找一种简单的方法来将一些图片映射到Web文件夹HIERARCHY之外的服务器上。 The web server DOES have use of the other server. Web服务器确实使用了其他服务器。

In this case (like so many business) there are other applications that create +_maintain these pictures. 在这种情况下(就像很多企业一样),还有其他应用程序可以创建+ _maintain这些图片。 Thus like most business over the years that adopted personal computers, they over time start to pile up applications and systems that create documents which ultimately reside on one of their servers. 因此,就像多年来采用个人计算机的大多数企业一样,随着时间的推移,他们开始堆积应用程序和系统,这些应用程序和系统创建最终驻留在其服务器之一上的文档。

So every dog, beetle and living business and thus web developer MUST HAVE at one point in time had to deal with the above super common request of allowing the web site to utilize some folders on the network. 因此,每一个狗,甲虫和有生命的企业,以及因此的Web开发人员,都必须在某个时间点处理上述超级通用的请求,即允许网站利用网络上的某些文件夹。 And this simply means the requirement to use these files from the web site. 这只是意味着需要使用网站上的这些文件。 And it is unlikely or even practical that all other business process that create these files should have to change their current folder(s) they been using for years and years that reside on that server. 创建这些文件的所有其他业务流程都必须更改它们驻留在该服务器上多年的当前文件夹,这不太可能甚至不可行。

Now that the world is moving towards the web does anyone have a common solution to the above? 现在,世界正在走向网络,是否有人对上述内容有一个共同的解决方案?

It would seem to me the no brain solution dead in the water solution would be if we could simply to map these network folders to the web site. 在我看来,如果我们可以简单地将这些网络文件夹映射到网站,那么无脑的解决方案就会死于水溶液。 At that point then it simple code to stuff into an image controls the folder path name. 此时,将简单的代码填充到图像中即可控制文件夹路径名。 Of course right now such folders outside of the web folder hierarchy are not available to HTTP requests, but certainly can be shared to the web server. 当然,现在Web文件夹层次结构之外的此类文件夹不可用于HTTP请求,但可以共享给Web服务器。

Is there a "common" solution and approach to map such folders to the web site? 是否存在将此类文件夹映射到网站的“通用”解决方案和方法? Some have suggested that you trap the http requests and write custom code to trap such error but that seems to boarder on galactic stupidity. 有些人建议您捕获http请求并编写自定义代码以捕获此类错误,但这似乎使银河愚蠢更加容易。 (that like starting a fire by rubbing sticks when you have a working lighter in your pocket!). (就像口袋里有打火机的时候用木棍打火一样!)。

So do I have to write (at CPU cost) code to reads in such files as a file streams? 那么,我是否必须编写(以CPU成本为代价)代码以读取诸如文件流之类的文件?

I see some hints that I can "may" be able to provide additional directory's in the web config, so this would be my first choice. 我看到一些暗示,我可以“可能”在网络配置中提供其他目录,因此这是我的首选。

This environment is asp.net, vb.net and IIS (hosted on our own server which is why it has UNC use of those other servers where those images reside). 此环境是asp.net,vb.net和IIS(托管在我们自己的服务器上,这就是为什么它可以UNC使用这些图像所在的其他服务器的原因)。

So is there a super common solution to this super common problem? 那么,对于这个超级普通问题是否有一个超级普通的解决方案?

Is there some way, even at OS level to map such folders into to the web site hierarchy or will one have to resort to writing code and using file streams? 是否有某种方法,甚至在OS级别上,也可以将此类文件夹映射到网站层次结构中?还是必须诉诸于编写代码和使用文件流?

Best regards 最好的祝福

As kaveman pointed out in the comments - a Virtual Directory in IIS will allow you to map a folder on the website to a network share. 正如kaveman在评论中指出的那样-IIS中的虚拟目录将允许您将网站上的文件夹映射到网络共享。 The only complicated bit here is permissions - whoever the application is running as will need access to the network share or you can configure IIS to connect as a particular user for the virtual directory. 这里唯一复杂的一点是权限-运行应用程序的任何人都需要访问网络共享,或者您可以配置IIS以虚拟用户的特定用户身份进行连接。

I believe if you are using windows authentication then permissions can actually be configured based on the logged in user, though I haven't used that method (I've usually used this as a means to limit disk usage on a single web server or more often to share a single source of files across several web servers/applications, always using non-windows based accounts and/or anonymously available). 我相信,如果您使用的是Windows身份验证,则实际上可以根据登录的用户配置权限,尽管我没有使用过这种方法(我通常将其用作限制单个Web服务器或更多Web服务器上磁盘使用量的一种方法通常会在多个Web服务器/应用程序之间共享单个文件源,始终使用非基于Windows的帐户和/或匿名提供)。

The alternative you mentioned also works - Writing code to handle requests that retrieves the files and serves them up. 您提到的替代方法也适用-编写代码以处理检索文件并提供服务的请求。 I've used this method to get a little more control over permissions and logging and such inside a custom app, but as you said, this means you are using some CPU/memory for each request. 我已经使用这种方法对自定义应用程序内部的权限和日志进行了更多控制,但是正如您所说的,这意味着您为每个请求使用了一些CPU /内存。

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

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