App_Data 文件夹在 Visual Studio 中的用途是什么? [英] What is the App_Data folder used for in Visual Studio?

查看:27
本文介绍了App_Data 文件夹在 Visual Studio 中的用途是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Visual Studio 中创建新的 ASP.NET 应用程序时,会自动创建几个文件和文件夹.其中一个文件夹名为 App_Data.

When creating a new ASP.NET application in Visual Studio, a couple of files and folders are created automatically. One of those folders is called App_Data.

此外,通过选择菜单选项 Build->Publish 发布网站时,可以使用一个复选框包括 App_Data 文件夹中的文件.

Also when publishing a website by selecting the menu option Build->Publish a checkbox is available Include files from the App_Data folder.

我是否正确假设放入此文件及其子文件夹中的文件将无法通过网络访问?例如,将我仅打算由应用程序代码使用的资源放入该文件夹中是否安全?

Am I right assuming that the files put in this file and its sub-folders are not going to be accessible through the web? For example, would it be safe to put in that folder resources that I only intend to be used by the application code?

App_Data 文件夹的真正用途是什么?

What is the real intended use of the App_Data folder?

谢谢大家的回答.从目前收到的答案来看,我主要对提到的两点感兴趣:

Thank you for all the answers. From the answers received so far I am interested mostly in two points mentioned:

  1. App_Data 本质上是一个存储基于文件的数据存储点
  2. 它不应该是可见的通过网络,是网络应用程序存储和读取数据的地方

有人能指定如何确保网络不可见"吗?在执行标准部署时,我是否可以依赖该事实,或者我是否还需要检查服务器上的某些 IIS 设置.

Would someone be able specify how the "not viewable by the web" is ensured? Can I rely on that fact when performing standard deployment, or do I need to check some IIS settings on the server as well.

如果我有一组 pdf 文件,我只想从应用程序访问这些文件.App_Data 文件夹是正确的使用位置,还是我应该创建一个单独的文件夹并手动设置 IIS 以确保它不能被 Web 访问?

In the situation when I have a set of pdf files that I want to be accessible only from the application. Would App_Data folder be the right place to use, or should I create a separate folder and manually set IIS to ensure that it is not accessible by Web?

推荐答案

App_Data 本质上是基于文件的数据存储(而不是 SQL 服务器数据库存储)的存储点.例如,一些简单的网站将它用于存储为 XML 的内容,通常在数据库托管费用昂贵的情况下.

App_Data is essentially a storage point for file-based data stores (as opposed to a SQL server database store for example). Some simple sites make use of it for content stored as XML for example, typically where hosting charges for a DB are expensive.

这篇关于App_Data 文件夹在 Visual Studio 中的用途是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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