如何prevent SQL Server的防爆preSS数据库文件自动创建错误? [英] How to prevent SQL Server Express database file auto-creation error?

查看:207
本文介绍了如何prevent SQL Server的防爆preSS数据库文件自动创建错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试在我的本地IIS 7运行MVC 2应用程序,我不断收到此错误:

When I try to run an MVC 2 app on my local IIS 7, I keep getting this error:

无法生成SQL Server的用户实例由于故障
  检索用户的本地应用程序的数据路径。请确保
  用户具有在计算机上的本地用户简档。连接将
  被关闭。

Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path. Please make sure the user has a local user profile on the computer. The connection will be closed.

不过,我没有连接到SQL Server防爆preSS什么,和我所有的连接字符串做工精细,当我在我的本地运行。

However, I don't have anything connected to SQL Server Express, and all my connection strings work fine when I'm running on my localhost.

什么是这种错误的原因?我怎样才能prevent呢?

What is the cause of such an error? How can I prevent it?

推荐答案

ASP.NET应用程序,包括MVC 2的人,在默认情况下创建一个SQL Server数据库来存储用户和角色。该数据库被称为ASPNETDB并存储在App_Data文件夹 - 如果它现在还没有,ASP.NET将尝试应用程序启动时创建它。

ASP.NET applications, including MVC 2 ones, by default create a SQL Server database to store users and roles. The database is called ASPNETDB and is stored in App_Data folder - if it is not there yet, ASP.NET will try to create it when the application starts.

要创建/打开这个数据库,使用SQL Server,前preSS的用户实例。要启动用户实例的用户配置文件必须加载为当前用户(在这种情况下,无论占ASP.NET应用程序池运行)。但是,对于IIS应用程序池的默认配置是不加载用户配置文件,以限制启动时间的时间和节省内存。

To create/open this database, User instance of SQL Server Express is used. To start a User Instance the user profile must be loaded for the current user (in this case whatever account the ASP.NET application pool runs as). But the default configuration for IIS application pools is not to load the user profile to limit start time time and save memory.

要启用一个应用程序池加载用户配置文件中去其在IIS管理器配置和寻找的加载用户配置文件高级选项开关。将其设置为真正,它应该工作。

To enable loading user profile for an application pool go to its configuration in IIS Manager and look for Load User Profile switch in Advanced Options. Set it to true and it should work.

如果您宁愿避免使用用户实例和加载用户配置文件,您可以使用您的应用程序的用户和角色不同的数据库。只要到IIS管理器中再次找到你的网站,并查找连接字符串在ASP.NET配置部分。我敢打赌,你会看到一个名为 LocalSqlServer 的连接字符串那里。只要更新它指向你要使用的数据库。你可以看到<一个href=\"http://stackoverflow.com/questions/1611937/how-to-use-aspnetdb-database-with-an-asp-net-website\">this螺纹了解如何创建一个新的数据库ASPNETDB。如果你在主SQL Server实例创建它,你将不再需要在配置文件连接到 - 只需创建的SQL Server登录,并确保您连接字符串使用它

If you would rather avoid using User Instances and loading the user profile, you can use a different database for your application's users and roles. Just go to IIS Manager again, find your Web Site, and look for Connection Strings section in ASP.NET configuration. I bet you will see a connection string called LocalSqlServer there. Just update it to point to the database you want to use. You can see this thread to learn how to create a new ASPNETDB database. If you create it on the main SQL Server instance you will not need the profile to connect to - just create a login in SQL Server and make sure your connection string is using it.

这篇关于如何prevent SQL Server的防爆preSS数据库文件自动创建错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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