简体   繁体   English

在ASP.NET中,将上载的文件存储到关系数据库中还是将其放入文件系统中更好?

[英]In ASP.NET is it better to store an uploaded file into a relational database, or put it into the file system?

Is it good to store the uploaded file into a relational database or put it in a file system under a directory in IIS? 将上载的文件存储到关系数据库中还是放在IIS中目录下的文件系统中是否很好? I thought relational system will be a better choice. 我认为关系系统将是一个更好的选择。 Any comments? 任何意见? When will you use one over the other? 什么时候可以使用另一个?

EDIT: RDBMS, will make it easier to relate multiple file attachments to a record. 编辑:RDBMS,将​​使关联多个文件附件到一条记录变得更加容易。 It's easier to maintain version(s) 维护版本更容易

File systems make it easier to store data and I think performance wise this is a better choice. 文件系统使存储数据更加容易,我认为从性能角度来看,这是一个更好的选择。

It really depends on the case. 这确实取决于情况。 If you are storing very large files your DB will become really big - consider this - it may affect the price of your hosting. 如果要存储非常大的文件,则数据库将变得非常大-请考虑这一点-这可能会影响托管价格。

Storing files in a DB is preferred when you are in a web farm - for example if the requests to your application are processed by several servers and you store the files in a DB, then SQL clustering is all you need, and storing the files in the file system in such case is a lot harder - you have to use a common location or synchronize the files through the server farm! 在Web场中时,最好将文件存储在DB中-例如,如果对应用程序的请求由多个服务器处理并且您将文件存储在DB中,则只需要SQL群集,然后将文件存储在在这种情况下,文件系统要困难得多-您必须使用公共位置或通过服务器场同步文件!

I would use a DB for a file store - one location for all the data related to your application - easier to maintain and backup/restore! 我将使用DB来存储文件-一个与您的应用程序相关的所有数据的位置-易于维护和备份/还原!

Here is an article explaining how to store in a DB: http://www.dbazine.com/sql/sql-articles/charran5 这是一篇介绍如何存储在数据库中的文章: http : //www.dbazine.com/sql/sql-articles/charran5

Here is an interesting reading about SQL Server 2008 and the filestream feature: http://www.devx.com/dotnet/Article/40812 这是有关SQL Server 2008和文件流功能的有趣读物: http : //www.devx.com/dotnet/Article/40812

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

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