-->

What do the ASP.NET Universal Providers enable tha

2020-03-27 05:20发布

问题:

Inside the readme file of the ASP.NET Universal providers NuGet package is this quote

The SqlMembershipProvider, SqlRoleProvider, SqlProfileProvider classes that shipped in ASP.NET through version 4 support only Microsoft SQL Server and Microsoft SQL Server Express. They do not support newer offerings such as Microsoft SQL Azure and Microsoft SQL Server Compact.

However, when I run the custom aspnet_regsql scripts for Sql Azure http://support.microsoft.com/kb/2006191 and then point my web.config to the SQL Azure database, ASP.NET membership seems to work correctly.

Can anyone tell me what exactly doesn't work with SQL Azure, that the universal providers enable?

回答1:

The main difference, as far as I can tell, is that when you connect to Sql Azure you need to implement retry logic. The original providers won't retry when a connection error occurs and this will happen from time to time with SQL Azure.

Also, the original providers don't raise exceptions containing the full SQL error codes so if your database is being throttled you won't know which throttling rule is being applied. At least this is what the SQL Azure support team tell me - I'm currently in the process of upgrading for this reason.

A note of caution: the Universal Providers seem to use a different database schema to the original providers, so you will need to migrate membership data. If you are starting a new project it will be much easier to change these providers before you go live with real users!



回答2:

the universal providers enable you to use asp.net membership system on sqlazure and also make the implementation sql agnostic. you can take the same app using universal providers and change the datasource to be sql server/sqlexpress/sqlce/localdb etc