I am not at all familiar with ASP.NET membership/roles. This is my first time using it, and my first time trying ASP.NET MVC. When I create my first project for MVC, it gives me a lovely template to create an account. I was excited to see that I did not have to do this manually. However, it failed because it cannot connect to SQL Server. I do not have SQL Server, I have MySQL. Is there any easy way I can get this system to use MySQL instead, or will I have to create my own authentication?
Got it figured out! Using version 6.2.2.0 of MySql Connector/Net, follow these steps...
Add reference to MySql.Web.dll
Change your <membership> in web.config to this:
<membership defaultProvider="MySqlMembershipProvider">
<providers>
<clear/>
<add name="MySqlMembershipProvider"
type="MySql.Web.Security.MySQLMembershipProvider,
MySql.Web, Version=6.2.2.0, Culture=neutral,
PublicKeyToken=c5687fc88969c44d"
autogenerateschema="true"
connectionStringName="NAME_OF_YOUR_CONN_STRING"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="false"
requiresUniqueEmail="false"
passwordFormat="Hashed"
maxInvalidPasswordAttempts="5"
minRequiredPasswordLength="6"
minRequiredNonalphanumericCharacters="0"
passwordAttemptWindow="10"
passwordStrengthRegularExpression=""
applicationName="/"
/>
</providers>
</membership>
Run the Project | ASP.NET Configuration tool and click on the Security tab to test
Tested on ASP.NET 3.5, MySQL Server version 5.1, Windows XP 64-bit
The original question didn't specify which version of ASP.NET & MVC was used. With the recent release of .NET 4.5 and MVC 4 I hit the same problem as the OP but with the new technologies. This is my quick fix for it mostly the same config as Josh Stodola's answer but with some additional steps.
<membership defaultProvider="MySqlMembershipProvider">
<providers>
<clear />
<add name="MySqlMembershipProvider"
type="MySql.Web.Security.MySQLMembershipProvider,
MySql.Web, Version=6.5.4.0, PublicKeyToken=c5687fc88969c44d"
autogenerateschema="true"
connectionStringName="*NAME_OF_YOUR_CONN_STRING*"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="false"
requiresUniqueEmail="false"
passwordFormat="Hashed"
maxInvalidPasswordAttempts="5"
minRequiredPasswordLength="6"
minRequiredNonalphanumericCharacters="0"
passwordAttemptWindow="10"
passwordStrengthRegularExpression=""
applicationName="/" />
</providers>
</membership>
Get the AccountController and Views working:
Delete the MVC 4 AccountController, AccountModels, Account view folder and _LoginPartial shared view
Create a new MVC 3 web application
Copy the MVC 3 AccountController, AccountModels, Account view folder and _LogOnPartial shared view into your MVC 4 application
Replace #Html.Partial(“_LoginPartial”) in the shared _Layout view with #Html.Partial(“_LogOnPartial”)
I've did this with asp.net but I think it could be used for mvc too: hasangursoy.com.tr/aspnet-authorization-authentication-with-mysql
In my scenario, I do not need to connect to MySQL from my .NET web applications. Therefore, I solved this problem by doing two things:
1) Uninstall MySQL .NET Connector (all versions)
2) Inside the Web.Config file, remove all keys that were added after the MySQL installation. (Or else, copy back the original Web.Config file before installation to the .NET web application root folder)
Now, my .NET application is bac
Had to go through something similar.
Here's the official MySql walkthrough that helped me:
Tutorial: MySQL Connector/Net ASP.NET Membership and Role Provider
Note: In my case, the machine.config to be edited was the 32 bit one (they didn't specify which, and editing the 64bit one didn't help).
Click on the menu Project followed by ASP.NET Configuration.
That will create the sql database for you in the Data folder.
Use Visual Studio to look at the data.
Hope this helps.
Edit
I should add that you can then use Ctrl+Alt+S to see the Server Explorer which should then allow you to see your database with its tables and the data.
You shouldn't need SQL installed.
Related
So I have already spent about 2 days trying fix this. I have succeeded in fixing this on my workplace pc and can't get it to work on my home pc. I have read about a dozen SO articles and oracle forums articles and whatnot but still it does not work.
I have 1.2.4 msql for visual studio which is supposed to be a release which works on vs2015. I have installed mysql connector 6.8.6 and have first tried to add mysql to my project via nuget but after not being able to find a 6.8.6 version (there are 6.8.3 and 6.9.7 for one package and then again something else for the other...) I have referenced to my C:\Program Files (x86)\MySQL\MySQL Connector Net 6.8.6\Assemblies\v4.5 and have taken the 4 files there and have copied them ove the whole fkin computer. I have pasted it like everywhere. The vs2013 private assembly, my packages folder which I do not even reference to anyway and I think some vs2015 folder. I have ran a search for Mysql.Data and have pasted these files in every folder that came up as a result. I have rebuilt the solution for about 100-200 times and have cried for at least 20 minutes.
What do I have to do to get my new ADO.Net Entity Data Model generated?
I keep getting this stupid
image and I have really absolutely no idea what to do next. I just want to code but every time I start doing something I keep wasting days on tools not working. Do I really have to code in notepad so that I am sure it's my fault that something isn't working?
This is my app.Config file. I do not have anything else in my project.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="v12.0" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
<system.data>
<DbProviderFactories>
<remove invariant="MySql.Data.MySqlClient" />
<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.8.6.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</DbProviderFactories>
</system.data>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.8.6.0" newVersion="6.8.6.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<connectionStrings>
<add name="KPlusConnectionString" connectionString="server=dito.ninja;user id=xxx;password=xxx;database=xxx" providerName="MySql.Data.MySqlClient" />
</connectionStrings>
</configuration>
In order for VS 2015 to connect to MySql you need to be using a later version of the MySql libraries. While that seems like a pretty simple answer, in all honesty I have run into several problems along the way. With that in mind I am going to write out the 1 process that has consistently worked for me as far as getting EF working with MySql and VS2015. So, without further ado, here are the steps I have been taking in order to get this to work.
1) Make sure the MySql connector installation is updated
2) Create your web project
3) Open Nuget
4) Install Entity Framework
5) Search for MySql
6) Install MySql.Data
7) Install MySql.Data.Entity
8) Install MySql.Data.Entities
9) Install MySql.Web
10) Go to the references for the project and delete MySql.Data.Entity.EF6
11) Check the versions of the MySql.Data and MySql.Web libraries. If they are under 6.9.6 delete them as well
12) Add a new reference by browsing to the install location for the mysql connector for your version of the .NET framework (mine is C:\Program Files (x86)\MySQL\Connector.NET 6.9\Assemblies\v4.5) and grabbing the MySql.Data.Entity.EF6.dll (my version is 6.9.6, keep that in mind when we change the web.config later)
13) If the other libraries were also older versions, add references to them by browsing to the packages folder in your solution and grabbing the files from their respective folders. I do not normally have to do this.
14) Now the Web.config will need to be edited. The first step is to replace the entity framework section with this code (change the version number to your current version. Please note that I found this snippet on the web a couple weeks ago and do not have the original link. I apologize to the original poster of this information.)
<entityFramework>
<defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.Entity.EF6" />
<providers>
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6, Version=6.9.6.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</providers>
</entityFramework>
15) Make sure your DbProviderFactories section matches
<DbProviderFactories>
<remove invariant="MySql.Data.MySqlClient" />
<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.9.6.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</DbProviderFactories>
16) Save and build
I am not sure how many of these steps are actually required but after finally getting it once I had to actually get some work done and didn’t have time to narrow things down further. Hopefully that gets you moving.
P.S. If after all of that you go through the wizard and it just disappears before it shows you the tables in the database to create entities from then it could be one of three problems I have run into along the way. The database server cannot be contacted. The user does not have the needed permissions on the database. The wrong version of MySql.Data.Entity.EF6 was added as a reference or the version number is wrong in the web.config. If I grab this file from the packages directory of my solution I often run into this aborted-wizard-with-no-error-message problem. Grabbing it from the MySql install directory has worked fine for me every time.
It works for me.
I have Visual Studio 2015, and just installed latest version of connector:
http://dev.mysql.com/downloads/windows/visualstudio/
Read this more carefully:
http://dev.mysql.com/doc/relnotes/mysql-for-visual-studio/en/visual-studio-news-1-2-4.html
They mention that version of "Microsoft ASP.NET MVC" could be a problem.
Wrong is that they say VS2015 ships with version 5, but I have version 4 installed with VS2015 Enterprise final.
Tried this and it didn't work for me. What eventually worked was making sure I had the right driver. I run a 64bit Windows 7 computer. I eventually had to install the 32bit version of the MySQL ODBC connector/driver and used the following connection string "Provider=MSDASQL; Driver={MySQL ODBC 5.3 ANSI Driver}; Server=localhost; Database=xxxx; User=xxxx; password=xxxx; Option=3;" and that solved it. tested it on a new project without making all the above changes, and it worked just fine. This post was super helpful in explaining this: https://support.microsoft.com/en-us/kb/942976. Hope this saves someone a lot of time
install the package from this site. http://dev.mysql.com/downloads/windows/visualstudio/ in the Development release tab.
I stopped Visual Studio.. I installed. WAITED.. Seams to take for ever. Visual studio will be running in the background.
Wait till completed.
reopen Visual Studio. boom back in play!
Good luck !
For VS2015 I removed all version installed and through the MySql Installer - Community. I selected Customize Installation and selected MySQL Connectors to install: 1. MySql for Visual Studio 2) MySQl ConnectorNet.
I added references: MySql.Data y MySql.Data.Entity.EF5 both in
C:\Program Files (x86)\MySQL\Connector.NET 6.9\Assemblies\v4.5\
Recompiled the project And When creating de ADO.Net Object the famous MySql data provider was shown!
A warning was displayed about Entity Frame Versions, I just clicked Next And worked![enter image description here][1]
I'm trying to use Entity Framework with MySQL and I get the above error. I have the latest MySQL connector installed.
The full error reads:
No Entity Framework provider found for 'MySql.Data.MySqlClient' ADO.NET provider. Make sure the provider is registered in the 'entityFramework' section of the application config file.
However, I can't find anything that suggests just how you register it in the 'entityFramework' section.
Some other posts (example) suggest adding the provider to the system.Data DbProviderFactories section like this:
<DbProviderFactories>
<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.2.3.0, Culture=neutral,
PublicKeyToken=c5687fc88969c44d" />
</DbProviderFactories>
But that doesn't work because it claims that the invariant name is duplicated. And, if I actually iterate through the System.Data.Common.DbProviderFactories I can see the last one is the MySQL provider:
MySQL Data Provider
.Net Framework Data Provider for MySQL
MySql.Data.MySqlClient
MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.6.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d
So the provider is there, but EF refuses to use it. Any ideas?
My full config looks like this:
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<system.data>
<!--<DbProviderFactories>
<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.2.3.0, Culture=neutral,
PublicKeyToken=c5687fc88969c44d" />
</DbProviderFactories>-->
</system.data>
<connectionStrings>
<add name="myContext" connectionString="server=****;User Id=****;password=****;Persist Security Info=True;database=myDb"
providerName="MySql.Data.MySqlClient" />
</connectionStrings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="v11.0" />
</parameters>
</defaultConnectionFactory>
</entityFramework>
</configuration>
in EF5 or less, all ok.
in EF6, you need to use mysql connector 6.8.x, and add DbConfigurationTypeAttribute to you DbContext:
[DbConfigurationType(typeof(MySql.Data.Entity.MySqlEFConfiguration))]
public class DemoContext : DbContext{}
which MySqlEFConfiguration is in MySql.Data.Entity.EF6.dll in 6.8.x. Have a try!
You need to create this section in config (EF 5):
<entityFramework>
<!-- ... -->
<providers>
<provider invariantName="MySql.Data.MySqlClient"
type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity" />
</providers>
</entityFramework>
Update: Use this definition for EF 6:
<entityFramework>
<!-- ... -->
<providers>
<provider invariantName="MySql.Data.MySqlClient"
type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6" />
</providers>
</entityFramework>
Thanks to elcool.
I just had the same situation when trying to configure Visual Studio Professional 2017 environment with MySQL, ADO.NET (Database First) and EF6.
After going through hell with every connector/NET available, I got it to work with Connector/NET v6.9.10 and following the steps below.
Uninstall/remove "Connector/NET" and "MySQL for Visual Studio" if installed.
Install "MySQL for Visual Studio" v2.0.5 CTP (MySQL for Visual Studio).
Note: Install MySQL for Visual Studio before Connector/NET.
Install "Connector/NET" v6.9.10 (Connector/Net).
https://i.stack.imgur.com/XOT1I.jpg Note: I tried using Connector/NET v6.8, v6.10 and v8 first, but none of them worked Here you can find all Connector Versions and Compatibilities with Visual Studio IDEs, but so far this list is inaccurate.
Download and Install "EntityFramework" v6.2.0 through NuGet.
Add references to C:\Program Files (x86)\MySQL\Connector.NET 6.9.10\Assemblies\v4.5\MySql.Data.dll
and
C:\Program Files (x86)\MySQL\Connector.NET 6.9.10\Assemblies\v4.5\MySql.Data.Entity.EF6.dll.
Add MySQL EF6 provider info inside App.config under entity framework providers as follow:
<entityFramework>
<providers>
<provider invariantName="MySql.Data.MySqlClient"
type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6" />
</providers>
</entityFramework>
Rebuild project.
And that was it. VS2017 was ready to go for me. Hope this works for everybody, as it did for me today.
References:
Can't Create Entity Data Model - using MySql and EF6
No Entity Framework provider found for 'MySql.Data.MySqlClient' ADO.NET provider
Just adding a summary of versions (since I saw you are trying 6.2 which is way too old)
For EF4, use Connector/NET 6.6.x (current GA is 6.6.6)
For EF5, use Connector/NET 6.7.x (current GA is 6.7.4) or Connector/NET 6.8.x (current GA is 6.8.3).
For EF6, use Connector/NET 6.8.x (current GA is 6.8.3).
I've updated from EntityFramework 5.0 to 6.1 and MySQL connector 6.8.3 and only had to add the attribute to get things going again. Before adding the attribute everything would compile fine but crash at runtime.
[DbConfigurationType(typeof(MySql.Data.Entity.MySqlEFConfiguration))]
public class DemoContext : DbContext{}
I tried every different combination of config string and setup but I finally figured it out. My solution has the source code in one project and tests in another. I was using Entity Framework 6.1.1 and had installed MySql Connector 6.8.3 and MySql for Visual Studio 1.2.3.
The problem was that I had NuGet managing the packages, but only had them included in the main project. The solution was to
Right click on the Solution (top level in the solution explorer)
Manage Nuget packages for solution
Go to Installed tab
For all of the EntityFramework related packages (MySql.Data, MySql.Data.Entities, MySql.ConnectorNET.Entity and MySql.ConnectorNET.Data), select them then select the "Manage" button.
Enable each package for all projects.
For future reference, here's the official guide on using MySQL Connector/Net with EF 6 which includes all the necessary steps (assemblies, configs, ...etc.):
Chapter 10 EF 6 Support
Install latest version from nuget
https://www.nuget.org/packages/MySql.Data.Entity/
In my case, it was a missing reference. When you upgrade to EntityFramework 6, you need to add a reference to the assembly
System.Data.Entity
I think it's because MySql.Data.Entity.EF6 inherits from a bunch of stuff in this assembly, that it did not for previous version of EF.
When your app.config is good and all your references seem fine, it's a solution worth checking.
Nevermind. I noticed that I had EF 6 installed. I removed it and tried EF 5 instead (which NuGet says is the latest stable version) and it started working.
Still, a more useful error message would have been nice!
May just MySql provider is installed in machine-config (e. g. by .net connector installer?
Also the default connection factory should be something like "MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.7.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" i guess...
I get the following error when running my MVC asp.net (.net 4.0) website on my hosting provider's server:
Attempt by method 'MySql.Data.MySqlClient.MySqlClientFactory.System.IServiceProvider.GetService(System.Type)' to access field 'MySql.Data.MySqlClient.MySqlProviderServices.Instance' failed.
The following should be known about this application:
It uses the entity framework. The hosting provider put a test .aspx
page on my website which does not use the entity framework which can
connect to the database.
The website works on my localhost, except
when I use their trust policy config file. In which case I get the
same error.
It worked before they did some updates, which included adding the SecurityClass MySqlClientPermission
I have searched for solutions, but found only answers to other problems with mysql connector. To show that these are not the issue I include those here:
This in included in the web.config:
<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.5.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" /> </DbProviderFactories>
They did include this in the trust config:
<SecurityClass Name="MySqlClientPermission" Description="MySql.Data.MySqlClient.MySqlClientPermission, MySql.Data, Version=6.5.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
<IPermission class="MySqlClientPermission" version="1"> <add connectionString="Server=;Database=;User=;Password=;Port=;Pooling=;" restrictions="" KeyRestrictionBehavior="PreventUsage" />
</IPermission>
Perhaps someone can point me in the right direction, because after trying a lot of things I am at a loss.
I have an MVC2 app that utilizes MySql.Web ver. 6.2.2.0, on my dev machine locally it works fine!
However, once I upload it to my http://www.winhost.com account I get the following error:
Parser Error Message: Unable to initialize provider. Missing or incorrect schema.
Line 32: <clear/>
Line 33: <add name="MySqlMembershipProvider"
Line 34: type="MySql.Web.Security.MySQLMembershipProvider,MySql.Web,
Version=6.2.2.0, Culture=neutral,PublicKeyToken=c5687fc88969c44d"
Is there something I can do to get this going? Or am I at the mercy of my host?
here is my config:
<membership defaultProvider="MySqlMembershipProvider">
<providers>
<clear/>
<add name="MySqlMembershipProvider"
type="MySql.Web.Security.MySQLMembershipProvider,MySql.Web, Version=6.2.2.0, Culture=neutral,PublicKeyToken=c5687fc88969c44d"
autogenerateschema="true"
connectionStringName="mysql"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="false"
requiresUniqueEmail="false"
passwordFormat="Encrypted"
maxInvalidPasswordAttempts="5"
minRequiredPasswordLength="6"
minRequiredNonalphanumericCharacters="0"
passwordAttemptWindow="10"
passwordStrengthRegularExpression=""
applicationName="/"
/>
</providers>
</membership>
Try these articles to help ensure your host, your MySQL instance, and your web app are configured correctly.
MySQL ASP.NET Membership and Role Provider
ASP.NET and MySQL - membership provider
Marvin Palmer has a great walkthrough on Implementing .NET Membership and Roles using MySql Connector
Another potentially related question.
Is it possible to setup ASP.NET MVC 2 to work with a MySQL database?
I'm assuming that you have Visual Studio Professional 2008, have access to an instance of MySQL server, and have moderate to advanced development experience. This MAY work with VS2008 Web edition, but not at all sure.
If you haven't, install MySQL Connector for .NET (6.2.2.0 at the time of this write-up)
Optional: install MySQL GUI Tools
If you haven't, install MVC 2 RTM, or better yet, use Microsoft's Web Platform Installer. (UPDATE: MVC 2 has now been released for quite some time)
Create an empty MySQL database. If you don't want to access your application with the MySQL root user account (insecure), create a user account and assign the appropriate privileges (outside the scope of this write-up).
Create a new MVC 2 application in Visual Studio
In the MVC 2 app, reference MySql.Web.dll. It will either be in your GAC, or in the folder that the MySQL Connector installer put it.
Modify the connection strings portion of your web.config:
<connectionStrings>
<remove name="LocalMySqlServer"/>
<add name="MySqlMembershipConnection"
connectionString="Data Source=[MySql server host name];
userid=[user];
password=[password];
database=[database name];"
providerName="MySql.Data.MySqlClient"/>
</connectionStrings>
8.
Modify the membership portion of your web.config:
<membership defaultProvider="MySqlMembershipProvider">
<providers>
<clear/>
<add name="MySqlMembershipProvider"
type="MySql.Web.Security.MySQLMembershipProvider, MySql.Web,
Version=6.2.2.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>
9.
Modify the role manager portion of your web.config:
<roleManager enabled="true" defaultProvider="MySqlRoleProvider">
<providers>
<clear />
<add connectionStringName="MySqlMembershipConnection"
applicationName="/"
name="MySqlRoleProvider"
type="MySql.Web.Security.MySQLRoleProvider, MySql.Web,
Version=6.2.2.0, Culture=neutral,
PublicKeyToken=c5687fc88969c44d"
autogenerateschema="true"/>
</providers>
</roleManager>
10.
Modify the profile portion of your web.config:
<profile>
<providers>
<clear/>
<add type="MySql.Web.Security.MySQLProfileProvider, MySql.Web,
Version=6.2.2.0, Culture=neutral,
PublicKeyToken=c5687fc88969c44d"
name="MySqlProfileProvider"
applicationName="/"
connectionStringName="MySqlMembershipConnection"
autogenerateschema="true"/>
</providers>
</profile>
At this point, you ought to be able to run the app and have the default ASP.NET MVC 2 home page come up in your browser. However, it may be a better idea to first run the ASP.NET Web configuration Tool (in Visual Studio top menus: Project -> ASP.NET Configuration). Once the tool launches, check out each of the tabs; no errors = all good.
The configuration tool at Nathan Bridgewater's blog was essential to getting this working. Kudos, Nathan. Look for the "Configuration Tool" heading half way down the page.
The public key token on the MySql.web.dll that I've posted here ought not change any time soon. But in case you suspect a bad token string from copying and pasting or whatever, just use the Visual Studio command line to run: "sn -T [Path\to\your.dll]" in order to get the correct public key token.
There you have it, ASP.NET MVC 2 running over MySQL. Cheers!
I belive at "10. Modify the profile portion of your web.config::"
<profile>
<providers>
<clear /> ...
<add type="MySql.Web.Security.MySQLProfileProvider,......
type= has to be:
type="MySql.Web.Profile.MySQLProfileProvider"
because in "MySql.Web.Security" I have not found any method MySQLProfileProvider.
(but using Version 6.4.4. for .NET 4.0)
And at least, you have to create your own classes for creating the database tables, if there is no ready configured database.
Harald