I'm just starting with ASP.NET MVC and I was trying the Authentication with this new architecture.
我刚刚开始使用ASP.NET MVC,我正在尝试使用这种新架构进行身份验证。
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'.
以下消息可能有助于诊断问题:无法加载类型“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).
现在,我在web.config中唯一改变的是连接字符串,我确定连接字符串不是问题(我在其他项目中使用的是相同的)。
EDIT: Here is the connection string: "Data Source=myMachine\SqlExpress;Initial Catalog=TestDB;User ID=TestUser;Password=123456"
编辑:这是连接字符串:“数据源= myMachine \ SqlExpress;初始目录= TestDB;用户ID = TestUser;密码= 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.
那么,有什么想法吗?正如我所说的,除了连接字符串之外,我没有更改web.config中的任何内容。
Thanks in advance,
提前致谢,
2 个解决方案
#1
Found the problem: I just need to COMPILE the solution BEFORE starting the WSAT.
发现问题:我只需要在启动WSAT之前编译解决方案。
Thanks to everyone for your answers.
感谢大家的回答。
#2
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:
好吧,就像消息所说,此功能需要启用实际管理,默认的MVC网站模板已禁用此功能。进入Web.config并更改:
<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.
还有一件事要检查:确保在创建SQL成员资格提供程序元数据时,您将以在运行时有用的用户身份进行连接。换句话说,如果以sa身份连接,则元数据将位于dbo架构中。但是如果你自己连接,那么元数据将在你的模式中,这对其他应用程序不一定有用。您应该运行SQL Server Management Studio以验证元数据放置在哪个架构中。
#1
Found the problem: I just need to COMPILE the solution BEFORE starting the WSAT.
发现问题:我只需要在启动WSAT之前编译解决方案。
Thanks to everyone for your answers.
感谢大家的回答。
#2
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:
好吧,就像消息所说,此功能需要启用实际管理,默认的MVC网站模板已禁用此功能。进入Web.config并更改:
<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.
还有一件事要检查:确保在创建SQL成员资格提供程序元数据时,您将以在运行时有用的用户身份进行连接。换句话说,如果以sa身份连接,则元数据将位于dbo架构中。但是如果你自己连接,那么元数据将在你的模式中,这对其他应用程序不一定有用。您应该运行SQL Server Management Studio以验证元数据放置在哪个架构中。