views:

208

answers:

2

Can someone explain what aspnet_regsql.exe is really used for?

When I create a standard ASP.NET MVC project in VS2008 and register a user, I get the db created with corresponding asp.net membership tables etc.

This uses the SQL Server Express 2005 as standard.

The forums I have found states that aspnet_regsql.exe is used when one is migrating the created SQL Server Express db to a SQL Server, fx. to a hosting server. I am right about this?

But is this change a global change, meaning that next time I start a new MVC project or standard Win Forms project and add a db, it will use SQL Server as provider and not SQL Server Express? Or is this aspnet_regsql.exe only used on a project basis?

A: 

Like you say, the aspnet-regsql will create the tables into any (Express or not) version of SQL Server. I -think- your main question is how do you know which database you're attaching to, right? If so, then that is handled in your web.config file in the "Membership" provider area. What I do is use a SqlMembershipProvider for my development (utilizing the tables created with aspnet_reqsql) and then switch to ActiveDirectoryMembershipProvider for production.

MSDN Article on aspnet_reqsql

Nick DeVore
A: 

aspnet_regsql.exe is a utility designed to prepare a database to work with asp.net providers. These providers provide services to asp.net applications such as user membership, roles, and profile management and require a database that adhere to specific schemas.

By running this application you can alter an existing database to adhere to these schemas or create the default database for these services (aspnetdb.mdf?).

I believe that the utility might also prepare some of the intrinsics for provider usage.

hqrsie