Using AspNetSqlProvider on Your Database

Technorati Tags:

Headline: Run “aspnet_regsql.exe”.

User Story: As a web developer I want to use the AspNetSqlProviders for my website using an SQL Server database so that I can more easily host the site.

Take 1:

I was excited about the new ASP.NET MVC 2 being in the beta for 2010. So I created a new site. I then went into my web.config file to change the connection string to the database I want to use. So the connection string that said “ApplicationServices” I changed to my database.

When you try to use the AspNetSqlProvider by selecting the ASP.NET Configuration (clicking the globe icon shown below):image

When I did that I got the following error message:

image

Other attempts (I sort of lost track) resulted in a database being created in the App_Data folder called ASPNETDB.

Take 2 – Success

So I opened a command prompt and navigated to C:\Windows\Microsoft.NET\Framework\v4.0.21006 and typed the command: aspnet_regsql.exe

image

Then you get a screen like this:

image

Next>

image

Next>

image

In this screen select the right server, credentials, and database. You’ll see a confirmation screen, then finally success:

image

Wouldn’t it be nice if…

I would like it if I was prompted with a message, “Your selected data store does not have the AspNetSqlProvider tables. Would you like to create those tables in the following database: MyDatabase?”


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.