<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="v11.0" />
</parameters>
</defaultConnectionFactory>
</entityFramework>
Is the above relevant? I just have it in there in order not to screw things further.
But below is what I'm interested in, it is a connection string of my local sql server
<connectionStrings>
<add name="ApplicationServices" connectionString="Data Source=localhost;Initial Catalog=TestDB;User ID=lews;Password='therin'" providerName="System.Data.SqlClient" />
"When you create a database on Sequelizer you can specify a connection string alias. This is done on the Sequelizer add-on page (follow the "Go to ..." link on the application overview). If you set this name as the name of your connection string in your configuration file, we'll automatically replace it with your Sequelizer connection string when your code is deployed."
That's a snippet from Appharbor's documentation. So I assume that Data Source, Initial Catalog, User ID and password is automatically replaced with the correct values by AppHarbor. But it can't connect for some reason.
Below is another string I am using with MySQL this time, again I assume that AppHarbor should automagically inject the right values, but the error it gives is:
"PeopleEntities cannot be found in the application configuration file"
What is going on?
<add name="PeopleEntities" connectionString="metadata=res://*/Context.People.csdl|res://*/Context.People.ssdl|res://*/Context.People.msl;provider=MySql.Data.MySqlClient;provider connection string="server=localhost;user id=root;database=people"" providerName="System.Data.EntityClient" />
</connectionStrings>
Btw, the names "PeopleEntities" and "ApplicationServices" are used as aliases on AppHarbor.
And I have no idea how to use the code given in the documentation, databases is just not my thing.. how do I use both local and remote conn strings? Where in the code do I build the string and inject it? Do I have to do it whenever I create a DBContext instance? Etc..
Any ideas will be great, thanks!
EDIT:
Btw, if I hard code the connection strings, in the app.config and use a wcftestclient, it works, it queries the database.. but this isn't a good idea, apparently the connection strings can change without warning.
Anyway if I deploy it with the strings hardcoded and connect to the database with my site.. it doesn't query the SQL server.. really confused :(
http://support.appharbor.com/discussions/problems/2687-solved-mysql-provider-with-entity-framework-problem
For Entity Framework:
This piece of markup is unbelievable important:
<system.data>
<DbProviderFactories>
<clear />
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient"
description=".Net Framework Data Provider for MySQL"
type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data,
Version=6.4.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</DbProviderFactories>
</system.data>
Oh make sure the MySQL connector assemblies are local. And it should be in your web.config file as well, to be extra sure place it in your WCF's App.config. Use the same addon alias in your connection string.
For SQL Server addon:
You need this markup in the web.config:
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5"/>
<membership>
<providers>
<clear />
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" />
</providers>
</membership>
<profile>
<providers>
<clear />
<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/" />
</providers>
</profile>
<roleManager enabled="true">
<providers>
<clear />
<add connectionStringName="ApplicationServices" applicationName="/" name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" />
<add applicationName="/" name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" />
</providers>
</roleManager>
</system.web>
And you should be good to go..
Related
I'm trying to get Entity Framework 6 to work with a MySQL database. I am following this guide:
http://bitoftech.net/2015/01/21/asp-net-identity-2-with-asp-net-web-api-2-accounts-management/
Where I'm replacing the local database with a MySQL one. I installed the MySQL.NET Connector/Net Nuget package. However, replacing the connection string with that of my host is giving me problems. I can't get the enable-migrations command to work properly. On their FAQ pages, my host states you need to use this connection string:
Server=myServerAddress;Database=MyDataBase;User=MyUser;Password=myPassword
Which led me to this connection string:
<add name="DefaultConnection" connectionString="Server=12.345.6.789:1234;Database=MyDatabaseName;User=MyUserName;Password=MySuperSecretPassword" providerName="System.Data.SqlClient" />
I set the IP and portnumber they gave me as a server. Note the providername. I get this error when running enable-migrations in the console:
An error occurred accessing the database. This usually means that the connection to the database failed. Check that the connection string is correct and that the appropriate DbContext constructor is being used to specify it or find it in the application's config file. See http://go.microsoft.com/fwlink/?LinkId=386386 for information on DbContext and connections. See the inner exception for details of the failure.
When I switch the providername to MySql.Data.MySqlClient, I get this error:
No Entity Framework provider found for the ADO.NET provider with invariant name 'MySql.Data.MySqlClient'. Make sure the provider is registered in the 'entityFramework' section of the application config file. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information.
What am I doing wrong? What's the simplest way to set up a connection to my MySQL database using EF6?
Edit:
My current web.config:
<connectionStrings>
<add name="DefaultConnection" connectionString="Server=x.x.x.x;Database=RademaekAuthentication;User=x;Password=x" providerName="MySql.Data.MySqlClient" />
</connectionStrings>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6" />
</providers>
Inside of your web.config, the entire config is under the tag <configuration>. Anywhere inside of that you need to have
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="v11.0" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6" />
</providers>
</entityFramework>
I recently had this problem and solved it with the following connection string:
<add name="DefaultMySqlConnection" providerName="MySql.Data.MySqlClient" connectionString="Data Source=localhost; port=3306; Initial Catalog=<name>; uid=<user>; pwd=<password>;" />
The Web.config also contains the following :
<entityFramework>
<defaultConnectionFactory
type="System.Data.Entity.Infrastructure.SqlConnectionFactory,
EntityFramework" />
<providers>
<provider
invariantName="MySql.Data.MySqlClient"
type="MySql.Data.MySqlClient.MySqlProviderServices,
MySql.Data.Entity.EF6" />
</providers>
And in the system.data tag(create it right before the </configuration> tag if it doesn't exist), add the following code:
<DbProviderFactories>
<remove invariant="MySql.Data.MySqlClient" /><add name="MySQL" description="ADO.Net driver for MySQL" invariant="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data"/>
</DbProviderFactories>
This is my DbContext class:
[DbConfigurationType(typeof(MySqlEFConfiguration))]
public class DatabaseContext : DbContext
{
public DatabaseContext(string connectionString)
: base(connectionString)
{ }
After this make sure to run the migrations and it hopefully works.
EDIT: Maybe it's worth mentioning I don't have the <providers> part in my config.
I am a newbie in ASP.net and just following Tutorials. This Particular Problem has been Giving me a Real Headache, I have developed a website in VS 2010 , used the ASPNETDB SQL server database provided by Asp.Net Login Controls for creating users and roles. Also added Some tables, After i Was Done Used the " publish to Provider " feature to generate the Script (ASPNETDB.MDF.sql) . I Used this Script to Generate the Database and Tables -Sql Server 2008 R2 management Studio, and Modified the web.config Like This-
<!--Connection String-->
<connectionStrings>
<remove name="LocalSqlServer" />
<add name="LocalSqlServer" connectionString="Server=AkumJamir-PC\SQLEXPRESS;Initial Catalog=ASPNETDB;Integrated Security=true" providerName="System.Data.SqlClient" />
<add name="con" connectionString="Server=AkumJamir-PC\SQLEXPRESS;Initial Catalog=ASPNETDB;Integrated Security=True"/>
<add name="ConnectionString" connectionString="Server=AkumJamir-PC\SQLEXPRESS;Initial Catalog=ASPNETDB;Integrated Security=True" providerName="System.Data.SqlClient" />
</connectionStrings>
<roleManager enabled="true">
<providers>
<remove name="AspNetSqlRoleProvider"/>
<add connectionStringName="ConnectionString" applicationName="/"
name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider,System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<remove name="AspNetWindowsTokenProvider"/>
</providers>
</roleManager>
<membership>
<providers>
<remove name="AspNetMembershipProvider"/>
<add connectionStringName="ConnectionString" enablePasswordRetrieval="true" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7" minRequiredNonalphaNumericCharacters="1" passwordAttemptWindow="5" passwordStrengthRegularExpression="" name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider,System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
</membership>
<webParts>
<personalization defaultProvider="AspNetSqlPersonalizationProvider">
<providers>
<remove name="AspNetSqlPersonalizationProvider"/>
<add name="AspNetSqlPersonalizationProvider" type="System.Web.UI.WebControls.Webparts.SqlPersonalizationProvider"
connectionStringname="ConnectionString" applicationName="/"/>
</providers>
</personalization>
</webParts>
Now The Problem is That Works On my Development Machine But on our Staging Server, It Doesnt connect to the Database whenever i try browse to Some Pages where i have some data to be displayed from the Database Neither Does the Login Page Work.The connectionString Looks Like This in the Server:
<!--Connection String-->
<connectionStrings>
<remove name="LocalSqlServer" />
<add name="LocalSqlServer" connectionString="Driver={SQL Native Client};Server=WIN-K16NMM4128C;Initial Catalog=ASPNETDB;Integrated Security=true" providerName="System.Data.SqlClient" />
<add name="con" connectionString="Server=WIN-K16NMM4128C;Initial Catalog=ASPNETDB;Integrated Security=True"/>
<add name="ConnectionString" connectionString="Data Source=WIN-K16NMM4128C\SqlServer2008;Initial Catalog=ASPNETDB;Integrated Security=True" providerName="System.Data.SqlClient" />
</connectionStrings>
I Am Eating My braings Away, I've Gone through the Topics Covered Already,,,, Thanks For any Advise...
I was facing the same issue. I've just enabled ASP/Authentication in IIS manager and I've set Basic Authentication=true. It is working now.
You are using integrated security in your connection strings. Configure it to use sql authentication. Something like this:
Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;
I've read several posts in this forum about this but nothing seems to work. I'm trying to replace the default SQL Server based providers with MySQL providers using the latest version of connector (6.3.6.0) and VS2010, but I keep getting an error when accessing the Security section in WSAT. Here are my steps:
1) create a new mysql database.
2) create a new MVC2 application.
3) change web.config as follows:
<connectionStrings>
<remove name="LocalMySqlServer"/>
<add name="LocalMySqlServer"
connectionString="Data Source=127.0.0.1;Port=3306;Database=Sample;User id=root;Password=mysql;"
providerName="MySql.Data.MySqlClient"/>
<remove name="ApplicationServices"/>
<add name="ApplicationServices"
connectionString="Data Source=127.0.0.1;Port=3306;Database=Sample;User id=root;Password=mysql;"
providerName="MySql.Data.MySqlClient" />
</connectionStrings>
...
<membership defaultProvider="MySqlMembershipProvider">
<providers>
<clear/>
<add name="MySqlMembershipProvider" type="MySql.Web.Security.MySQLMembershipProvider,MySql.Web,Version=6.3.6.0,Culture=neutral,PublicKeyToken=c5687fc88969c44d"
connectionStringName="MySqlMembershipConnection"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="false"
requiresUniqueEmail="true"
passwordFormat="Hashed"
maxInvalidPasswordAttempts="5"
minRequiredPasswordLength="6"
minRequiredNonalphanumericCharacters="0"
passwordAttemptWindow="10"
applicationName="/"
autogenerateschema="true"/>
</providers>
</membership>
<profile>
<providers>
<clear/>
<add type="MySql.Web.Profile.MySQLProfileProvider, MySql.Web, Version=6.3.6.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"
name="MySqlProfileProvider"
applicationName="/"
connectionStringName="MySqlMembershipConnection"
autogenerateschema="true"/>
</providers>
</profile>
<roleManager enabled="true" defaultProvider="MySqlRoleProvider">
<providers>
<clear />
<add connectionStringName="MySqlMembershipConnection"
applicationName="/"
name="MySqlRoleProvider"
type="MySql.Web.Security.MySQLRoleProvider,MySql.Web,Version=6.3.6.0,Culture=neutral,PublicKeyToken=c5687fc88969c44d"
autogenerateschema="true"/>
</providers>
</roleManager>
<machineKey validationKey="AutoGenerate" validation="SHA1"/>
When I run WSAT and click Security, I get 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: The source was
not found, but some or all event logs
could not be searched. To create the
source, you need permission to read
all event logs to make sure that the
new source name is unique.
Inaccessible logs: Security.
Could anyone tell me what's wrong with this procedure? Thanks to all!
finally I got it working and I'd like to share the information here. I am using the latest version of Connector/Net (6.3.6) in an ASP.NET MVC 2 website. Here is what I did:
1) create a new MySql database (or just use yours if any).
2) ensure that your machine.config has enabled schema autogeneration for MySQLMembershpProvider. As you probably know, machine.config is typically placed under c:\windows\microsoft.net\framework[version]\config\machine.config. Find under the entry for MySQLMembershipProvider and append the attribute autogenerateschema="true" to the element . The whole element will look like this:
<add name="MySQLMembershipProvider" type="MySql.Web.Security.MySQLMembershipProvider, MySql.Web, Version=6.3.6.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionStringName="LocalMySqlServer" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="false" passwordFormat="Clear" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7" minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10" passwordStrengthRegularExpression="" autogenerateschema="true"/>
3) in your web.config (I'm referring to a newly created web application, so make your changes if required) change the connection strings and providers so that they refer to MySql. Typically: under connectionStrings add:
<remove name="ApplicationServices"/>
<add name="ApplicationServices" connectionString=connectionString="server=YOURSERVER;UserId=YOURUSER;password=YOURPASSWORD;Persist Security Info=True;database=YOURDATABASE;charset=utf8" providerName="MySql.Data.MySqlClient"/>
(BTW, notice the charset=utf8 in the connection string: this is not required for membership, but it is required if you are going to use this connection string to exchange Unicode data: it is not enough to just define the character set in your MySql table fields!).
Also, under membership / providers... ensure that the membership provider element (typically something like add name="AspNetSqlMembershipProvider"...) connectionStringName attribute refers to the connection string you set above (in my case, connectionStringName="ApplicationServices"). Do the same for profile and roleManager providers, which should look like this:
<profile>
<providers>
<clear/>
<add type="MySql.Web.Profile.MySQLProfileProvider, MySql.Web, Version=6.3.6.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"
name="AspNetSqlProfileProvider"
applicationName="/"
connectionStringName="ApplicationServices"
autogenerateschema="true"/>
</providers>
</profile>
<roleManager enabled="true" defaultProvider="MySqlRoleProvider">
<providers>
<clear />
<add connectionStringName="ApplicationServices"
applicationName="/"
name="MySqlRoleProvider"
type="MySql.Web.Security.MySQLRoleProvider,MySql.Web,Version=6.3.6.0,Culture=neutral,PublicKeyToken=c5687fc88969c44d"
autogenerateschema="true"/>
</providers>
</roleManager>
<machineKey validationKey="AutoGenerate" validation="SHA1"/>
(Note the SHA1 validation!).
4) launch WSAT from Visual Studio and let it configure your MySql database. It should create all the tables required and let you create users and assign roles. Beware of table names casing! With WSAT tables like myaspnet_Users (not myaspnet_users) are created, and this might lead to confusions (MySQL Workbench seems to be confused by this and will show you just 1 table if you have 2 tables with their names differing only by casing. Tools like Navicat seem smarter in this respect). It's best to let WSAT create its tables to avoid this fuss.
Finally, remember that if you are going to use my_aspnet... tables in some relationships, you must make sure you select the proper MySQL database engine, i.e. not MyISAM but InnoDB, otherwise your foreign keys even if set will be ignored.
That's all I can share for this issue. Hope this might save some hours to someone else...
Perhaps I found the culprit: the PC I was working today had not its machine.config (for .net 4) configuration set for autogenerateschema="true" (btw there is a typo in my code above, the connection string name is not correct, but this happened only by copy/paste in my post). So maybe this is useful for all the newcomers like me: remember to set autogenerateschema="true" in
Thanks anyway
First, my development environment: Win7 laptop with Visual Studio Professional 2010. IIS is NOT installed.
I'm trying to turn on and set up some roles for user management via the ASP.NET Configuration Tool, as demonstrated in the MVCMusicStore tutorial. When I click on the 'Security' tab, I get the following 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 'HandiGamer.MvcApplication'."
When I click on the 'button below', it tells me I'm using AspNetSqlProvider as my provider. When I try to test it, it tells me:
"Could not establish a connection to the database.
If you have not yet created the SQL Server database, exit the Web Site Administration tool, use the aspnet_regsql command-line utility to create and configure the database, and then return to this tool to set the provider."
Here's the thing:
The MVCMusicStore demo's role/user management works when I run it through the debugger. I can add myself as a customer, and add/remove items from my cart. Despite this, when I attempt to use the Configuration Tool with it, I get the same errors.
I actually have run aspnet_regsql on my copy of SQL Server 2008 Express. It created the necessary tables for user management. Still didn't fix my problem.
I'm just wondering if I'm missing something obvious, as the tutorial essentially said "Click two buttons and you're all set." It literally said nothing about setting up the db for this.
I'm just stumped at this point. Role/user management works (the MVCMusicStore proves that it does), but the configuration tool won't let me turn it on, set it up, or otherwise edit how it works. It's becoming very frustrating. Any help would be greatly appreciated.
EDIT: My web.config is as follows-
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=152368
-->
<configuration>
<connectionStrings>
<add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient" />
<add name="HandiGamer" connectionString="data source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|handigamer.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True" providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</assemblies>
</compilation>
<authentication mode="Forms">
<forms loginUrl="~/Account/LogOn" timeout="2880" />
</authentication>
<membership>
<providers>
<clear/>
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices"
enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false"
maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10"
applicationName="HandiGamer" />
</providers>
</membership>
<profile>
<providers>
<clear/>
<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="HandiGamer" />
</providers>
</profile>
<roleManager enabled="true">
<providers>
<clear/>
<add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="HandiGamer" />
<add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="HandiGamer" />
</providers>
</roleManager>
<pages>
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
</namespaces>
</pages>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
Found the solution. Had to compile/build my solution before the config tool would 'see' the db security stuff.
I am trying to use MySql Connector 6.2.2.0 for membership and role providers.
The issue I'm having is: Unable to initialize provider. Missing or incorrect schema.
<authentication mode="Forms"/>
<roleManager defaultProvider="MySqlRoleProvider"
enabled="true"
cacheRolesInCookie="true"
cookieName=".ASPROLES"
cookieTimeout="30"
cookiePath="/"
cookieRequireSSL="false"
cookieSlidingExpiration="true"
cookieProtection="All" >
<providers>
<clear />
<add
name="MySqlRoleProvider"
type="MySql.Web.Security.MySQLRoleProvider, MySql.Web,
Version=6.2.2.0,Culture=neutral, PublicKeyToken=c5687fc88969c44d"
connectionStringName="mySQL"
applicationName="capcafe"
writeExceptionsToEventLog="true"
/>
</providers>
</roleManager>
<membership defaultProvider="MySqlMembershipProvider">
<providers>
<add connectionStringName="mySQL"
applicationName="capcafe"
minRequiredPasswordLength="5"
requiresQuestionAndAnswer="false"
requiresUniqueEmail="false"
minRequiredNonalphanumericCharacters="0"
name="MySqlMembershipProvider"
type="MySql.Web.Security.MySQLMembershipProvider, MySql.Web, Version=6.2.2.0,
Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</providers>
</membership>
Here is the line it doesn't seem to like:
Line 57: type="MySql.Web.Security.MySQLRoleProvider, MySql.Web,
Version=6.2.2.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"
I have both MySql.Web and MySql.Data referenced and in my bin! Any help resolving this issue will be very much appreciated.
Add references to the assemblies, add autogenerateschema="true" attribute to both as:
<providers>
<remove name="MySQLProfileProvider"/>
<add name="MySQLProfileProvider" autogenerateschema="true" type="MySql.Web.Profile.MySQLProfileProvider, MySql.Web, Version=6.2.2.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionStringName="LocalMySqlServer" applicationName="/"/>
</providers>
use ASP.Net configuration tool.
I had this problem, it turned out there was no password in my connection string, I think checking carefully that your connection string is correct would be a good place to start.
My problem was I had "localhost" in my connection string instead of the IP address of the webhost's MySQL server.
Once I changed that in my web.config file it worked fine, so you need to check your web.config file very carefully.
I was experiencing this exact same issue. Mine ended up being a case issue since I was deploying my site to a linux server running Mono. Enabling autogenerateschema="true" helped me figure this one out. Some hosts won't let the code generate the necessary tables though, so if it doesn't auto-generate your schema then check out casing issues.
CodeMonkey's solution worked for me... I was actually deploying a new app to a Win 2008 Server VM. The schema could not be generated until I specified the LocalMySql connection string and set the MySQLRoleProvider autogenerate to true.