Store pictures as files or in the database for a web app?

后端 未结 10 1913
孤城傲影
孤城傲影 2020-11-22 06:32

My question is fairly generic and I know there might not be an 100% answer to it. I\'m building an ASP .NET web solution that will include a lot of pictures and hopefully a

10条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-22 07:21

    Store the pictures on the file system and picture locations in the database.

    Why? Because...

    1. You will be able to serve the pictures as static files.
    2. No database access or application code will be required to fetch the pictures.
    3. The images could be served from a different server to improve performance.
    4. It will reduce database bottleneck.
    5. The database ultimately stores its data on the file system.
    6. Images can be easily cached when stored on the file system.

提交回复
热议问题