VS2010 中的 ASP.NET 用户/角色管理 - 跳过 SQL Express 版本并直接进入 SQL Server 2008 R2
当我学习 ASP.NET 用户管理的细节时,我了解到 VS 中的默认设置是使用 SQL Server Express .mdf 文件来获取所需的数据节省。当我部署站点时,这对我没有帮助,因为我在 IIS 7.5 服务器上运行 SQL Server 2008 R2。我知道我可以运行命令行工具来自动创建用户管理所需的数据库表,并将在我的开发计算机上执行此操作,但是我如何告诉 VS 中现有的开发代码忽略现有的 Express .mdf文件并查看新创建的数据库表?
As I'm learning the ins and outs of ASP.NET user management, I've learned that the default in VS is for it to use a SQL Server Express .mdf file for the data it needs to save. This won't help me for when I deploy my site, as I'm running SQL Server 2008 R2 on my IIS 7.5 server. I know that I can run a command line tool to automatically create the db tables necessary for user management, and will do that on my development machine, but how do I tell my existing, in development code in VS to ignore the existing Express .mdf file and look at the newly created db tables?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只需更新您的 Web.Config 即可设置角色提供程序和数据库连接字符串:
http://weblogs.asp.net/scottgu/archive/2006/11/20/common-gotcha-don-t-forget -to-clear-when-adding-providers.aspx
http://www.codersbarn.com/post/2008/02/24/ASPNET-20-Guest-Book-Admin-Part-II.aspx
另外, Scott Mitchell 的成员资格和角色教程系列是我见过的最全面的:
http://weblogs.asp.net/scottgu/archive/2006/05/07/ASP.NET-2.0-Membership-and-Roles-Tutorial-Series .aspx
Simply update your Web.Config to set up the role provider and the database connection string:
http://weblogs.asp.net/scottgu/archive/2006/11/20/common-gotcha-don-t-forget-to-clear-when-adding-providers.aspx
http://www.codersbarn.com/post/2008/02/24/ASPNET-20-Guest-Book-Admin-Part-II.aspx
Also, Scott Mitchell's Membership and Roles tutorial series is the most comprehensive I've seen:
http://weblogs.asp.net/scottgu/archive/2006/05/07/ASP.NET-2.0-Membership-and-Roles-Tutorial-Series.aspx