What's the right process to use ASP.NET Web Site Administration Tool? I want to use this tool to configure roles and membership.
Steps that I tried:
Modify web.config of new webapplication:
<system.web> <roleManager enabled="true" defaultProvider="simple"> <providers> <clear/> <add name="simple" type="WebMatrix.WebData.SimpleRoleProvider, WebMatrix.WebData"/> </providers> </roleManager> <membership defaultProvider="simple"> <providers> <clear/> <add name="simple" type="WebMatrix.WebData.SimpleMembershipProvider,WebMatrix.WebData"/> </providers> </membership> ... ... <add name="DefaultConnection" connectionString="Data Source=(localdb)\\.\\IIS_DB;InitialCatalog=aspnet-DemoWebApplication-20130625124639;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnet-DemoWebApplication-20130625124639.mdf" providerName="System.Data.SqlClient" />
Error message seen on the tool page: 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: You must call the "WebSecurity.InitializeDatabaseConnection" method before you call any other method of the "WebSecurity" class. This call should be placed in an _AppStart.cshtml file in the root of your site.
Can you help? Please let me know if you need more information.
I've investigate this issue for hours, found below helpful threads, but still does not fix it completely:
It sounds like the connection string in your Asp.net app is not correct.
You can script those queries in the database directly if you need to.
Check your web.Config file and make sure all of your connections in there are correct. Are you using the simple membership? Or the Asp.net tables?
It turns out the SimpleMembership come with MVC 4 doesn't work with Web site admin tool. People use WebSecutiry API instead.
To use Web Site Admin Tool with MVC 4/VS 2012, you can either:
Remember to build the web application before use web site admin tool.
I was referring to this blog: http://weblogs.asp.net/jgalloway/archive/2012/08/29/simplemembership-membership-providers-universal-providers-and-the-new-asp-net-4-5-web-forms-and-asp-net-mvc-4-templates.aspx
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.