views:

823

answers:

2

I'm just starting with ASP.NET MVC and I was trying the Authentication with this new architecture.

So, I started following a tutorial in the official site and, while I was trying to add some users through the Web Site Administration Tool, I found this error:

There is a problem with your selected data store. This can be caused by 
an invalid server name or credentials, or by insufficient permission. 
It can also be caused by the role manager feature not being enabled. 
Click the button below to be redirected to a page where you can choose 
a new data store.

The following message may help in diagnosing the problem: Could not load type
'MyMvcApp.MvcApplication'.

Now, the only thing I changed in the web.config was the connection string and, I'm sure the connection string is not the problem (is the same I'm using in other project).

EDIT: Here is the connection string: "Data Source=myMachine\SqlExpress;Initial Catalog=TestDB;User ID=TestUser;Password=123456"

I tried several things and googled a lot, but nothing worked.

So, any ideas? as I said, I did not change anything in the web.config besides the connection string.

Thanks in advance,

+3  A: 

Well, like the message says, this feature requires real management enabled, and the default MVC web site template has this disabled. Go into Web.config and change:

<roleManager enabled="false">

to

<roleManager enabled="true">

One other thing to check: Make sure that when you create the SQL Membership Provider metadata you connect as a user who will be useful at runtime. In other words, if you connect as sa, then the metadata will be in the dbo schema. But if you connect as yourself, then the metadata will be in your schema, which isn't necessarily useful to other applications. You should run SQL Server Management Studio in order to verify in which schema the metadata is placed.

Craig Stuntz
I did turn it on, but did not work either =(
Hugo
OK; then you should probably tell us what you have already done and what happened when you tried instead of making us guess.
Craig Stuntz
I tried to copy from another web.config (in a WebForms app) the config for all the membership admin, I deleted all the config config and start the WSAT as Wizard and that didn't work either and, finally, I tried all the above with a new db with all activated options set (membership, role, etc).
Hugo
I updated the answer with one more thing to check.
Craig Stuntz
+4  A: 

Found the problem: I just need to COMPILE the solution BEFORE starting the WSAT.

Thanks to everyone for your answers.

Hugo