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):
When I did that I got the following error message:
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
Then you get a screen like this:
Next>
Next>
In this screen select the right server, credentials, and database. You’ll see a confirmation screen, then finally success:
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 Reply