使用与ASP.NET一个.MDF SQL Server数据库与使用SQL服务器 [英] Using a .MDF SQL Server Database with ASP.NET Versus Using SQL Server

查看:133
本文介绍了使用与ASP.NET一个.MDF SQL Server数据库与使用SQL服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在写在ASP.NET MVC网站,和我的数据库(它不具有任何数据然而,它只有正确的表)使用SQL Server 2008,我已经安装在我的发展机。我通过使用服务器资源管理器,然后是LINQ to SQL的映射连接到数据库了我的申请。

I'm currently writing a website in ASP.NET MVC, and my database (which doesn't have any data in it yet, it only has the correct tables) uses SQL Server 2008, which I have installed on my development machine. I connect to the database out of my application by using the Server Explorer, followed by LINQ to SQL mapping.

在我完成开发的网站,我将其移动到我的托管服务,这是一个虚拟的托管计划。我担心是否使用目前正在自己​​的计算机上的SQL Server安装程序将很难在生产服务器上做的,因为我必须通过主机控制面板导入所有数据库表。

Once I finish developing the site, I will move it over to my hosting service, which is a virtual hosting plan. I'm concerned about whether using the SQL Server setup that is currently working on my development machine will be hard to do on the production server, as I'll have to import all the database tables through the hosting control panel.

我注意到,有可能从Visual Studio中创建一个SQL Server数据库。然后,它被存储在App_Data目录

I've noticed that it is possible to create a SQL Server database from inside Visual Studio. It is then stored in the App_Data directory.

我的问题有以下几点:


  • 是否有意义移动我的SQL Server数据库从SQL服务器,进入App_Data目录为密度纤维板文件?

  • 如果是这样,如何我动了吗?我相信,这就是所谓的分离命令,不是吗?

  • 是否有任何的性能/安全问题可以与密度纤维板文件中像这样?
  • 出现
  • 请问我打算设置的工作确定一个典型的虚拟主机方案?我希望在密度纤维板数据库将不计入可与我的计划来创建SQL Server数据库的数量有限。

  • Does it make sense to move my SQL Server DB out of SQL Server and into the App_Data directory as an .mdf file?
  • If so, how can I move it? I believe this is called the Detach command, is it not?
  • Are there any performance/security issues that can occur with a .mdf file like this?
  • Would my intended setup work OK with a typical virtual hosting plan? I'm hoping that the .mdf database won't count against the limited number of SQL Server databases that can be created with my plan.

我希望这个问题不是太宽泛。在此先感谢!

<子>注:我刚开始学习ASP.NET MVC而这一切,所以我可能完全误解这是如何工作的

推荐答案

App_Data文件MDF是附会刚刚在时间到SQL Server实例的SQL Server数据库。访问一个MDF的唯一方法是通过连接到SQL Server。 Visual Studio中隐藏在幕后发生了什么,但你仍然在使用一个SQL Server实例。这只是即时密度板的附件只适用于SQL防爆preSS版本。在SQL防爆preSS 2005年,你最终会得到一个用户实例,请参见连接到SQL Server防爆preSS用户实例(ADO.NET)。随着SQL防爆preSS 2008年,你可以控制无论您希望用户实例或附加到服务实例。

The App_Data MDF is a SQL Server database that will be attached just-in-time to a SQL Server instance. The only way to access an MDF is by connecting to a SQL Server. Visual Studio hides what happens behind the scenes, but you are still using a SQL Server instance. This just-in-time attachment of the MDF works only on SQL Express editions. In SQL Express 2005 you would end up with a user instance, see Connecting to SQL Server Express User Instances (ADO.NET). With SQL Express 2008 you can control wether you want a user instance or attach to the service instance.

您与您的托管服务提供商联系,以确认他们是否算这个数据库作为的有一个的在计划或不是数据库。你必须要记住但从资源使用点,附着在连接字符串的数据库(也就是当你使用App_Data文件MDF部署选项会发生什么)仅仅是打开和运行的数据库的任何其他方式为贵,所以我听到他们允许它,不计入允许计划数据库的数量非常惊讶。

You will have to check with your hosting provider to confirm if they count this database as the one database in the plan or not. You have to keep in mind that from resource usage point of view, attaching a database by the connection string (which is what happens when you use the App_Data MDF deployment option) is just as expensive as any other way of opening and running database, so I'd be very surprised to hear they allow it and don't count against the number of database allowed in the plan.

这篇关于使用与ASP.NET一个.MDF SQL Server数据库与使用SQL服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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