共用方式為


Changing the default membership and role provider in Visual Studio 2005

When you initially install VS2005 and start to use the default membership and role providers for security, you usually use the default SQL provider for SQLExpress on your local box.

But what if I want to later change from SQL Express, and instead use a full blown version of SQL2005 , or some other data store from my role and membership data?

You would think that you could go into the new ASP.NET configuration tool, and change it there - but you can't.

After quite a bit of time, I found that you need to manually change the definition in web.config for your LocalSQLServer:

<connectionStrings>

<remove name "LocalSqlServer"/>

<add name "LocalSqlServer" connectionString="Data Source=SERVERNAME; Initial Catalog=aspnetdb;Integrated Security=True" providerName="System.Data.SqlClient"/>

</ConnectionStrings>

This will point to the new aspnetdb database that you created on SQLServer, with schemas created through the aspnet_regsql utility.

Naturally, this new schema will be empty, and you will need to script over the data from your old provider database to the new one manually