• Post Calendar

    November 2009
    S M T W T F S
    « Aug   Jan »
    1234567
    891011121314
    15161718192021
    22232425262728
    2930  

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?”

Leave a Comment