ASP.Net MVC3 Azure - Do I Need Membership Provider Stored Procedures?

∥☆過路亽.° 提交于 2019-12-12 12:26:02

问题


I am creating my first ASP.Net MVC3 Application using Azure as DB Storage. There are a number of great tutorials but I'm currently using this one: Walkthrough: Hosting an ASP.NET Web Application on Windows Azure

I've got my connection string hooked to Azure and its working fine. I run the application in Debug mode and "Register" my first user via the Membership Provider. According to the walkthrough, "Creating an account causes ASP.NET to create the membership database." Success! I now see the tables (Users, Roles,...) have been created in my Azure database. Great!

Why I'm Confused: Many years ago, when I did an ASP.Net 2.0 using the Membership Provider, I used the aspnet_regsql.exe to run all the scripts needed for the Membership Provider. I know they have an updated set of scripts for Azure. These scripts create all the tables but also create a large number of Stored Procedures (ex. aspnet_Membership_CreateUser)

My question: Do I need to run these updated Azure scripts to get the SPs? I don't see any Stored Procedures created in my database yet all the Membership Provider functionality seems to work just fine without them. What were all those Stored Procedures used for? Do I need them in my MVC3 Azure application?

Thanks!


回答1:


Since you’re following that tutorial, you’re already using the ASP.NET Universal Providers. One step in the tutorial adds the universal providers as a NuGet package. You can refer to http://nuget.codeplex.com/ for more information about NuGet. A Nuget package is essentially some pre-written code, which simplifies your development. For example, the universal providers automatically create the membership database tables based on your connection string. You can of course, continue to manually create the database tables, and then use the built-in ASP.NET membership provider.




回答2:


You should actually use the ASP.NET Universal Providers For SqlExpress 1.1. This is the officially supported method of enabling the SQL membership, role and session providers across both SQL Azure and standalone SQL Server. The Universal Providers should automatically create the necessary SQL objects for you, so you shouldn't have to run any scripts manually.

Here are a couple of links for reference:

Scott Hanselman - Introducing System.Web.Providers

SQL Azure Team Blog - Using SQL Azure for Session State



来源:https://stackoverflow.com/questions/10342055/asp-net-mvc3-azure-do-i-need-membership-provider-stored-procedures

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!