0

I am currently working on an ASP.Net MVC 3 tutorial on the MS ASP.Net website (MvcMusicStore). I use a database-first approach and have successfully modified the tutorial to access an independently created database through the Entity Framework instead of using the new EF 4.1 code-first approach, which is used in the tutorial. I use SQL Server 2008 R2 Developer Edition on my local machine.

The tutorial starts with an empty MVC website. The tutorial instructs on how to configure the website for the SQL provider through which user name and password registration occurs. I have been unable to get the provider to work. I actually created another separate MVC website with an account controller, and tried to register the provider through it (no code changes) and encountered the same problem. Obviously, cutting and pasting the relevant parts of the web config file from this second project into the empty tutorial did not fix the problem. I have been able to register and create an aspnetdb in SQL Server using aspnet_regsql. But my attempts to configure or access it have not worked. I have tried aspnet_regsql -A all -E, which gives me an error message. I have tried selecting the provider using the ASP.Net configuration tool that appears in the icon tray of the Solution Explorer in VS 2010. Have not been able to fix the problem.

Can anyone direct me to a solution to the problem? Is it simply the connection string? What am I missing?

Jack Herr
  • 95
  • 1
  • 11

1 Answers1

0

If you did not change any of the provider elements in the default MVC3 web.config, then you need to change the ApplicationServices connection string near the top of web.config to use the information to connect to your SQL Server aspnetdb database.

counsellorben
  • 10,924
  • 3
  • 40
  • 38
  • Absolutely. The tutorial is empty MVC 3 project. I found that if I created an unadulterated MVC 3 Internet Project, with the Account Controller, I could use the elements of the web config from that project to cut and paste into the tutorial. I did that for all the roles, membership, etc., stuff -- basically everything that was not in the web config for the empty project. I also had to set roleManager enabled="true" and change the connection string. I used:, change the namespace in the cshtml code copied from the tutorial download, and – Jack Herr Oct 06 '11 at 19:40
  • Continuing: . . . I used a simple connection string. Configuration then worked fine. Thank you.I also found that the controller cshtml copied from the downloaded tutorial files needed namespace change to correct a resource availability error. – Jack Herr Oct 06 '11 at 19:43