0

I am new to ASP.NET and I am using this tutorial http://www.codeproject.com/Articles/470107/ASP-NET-MVC-Part-Introduction to learn some basics.

I have created a project using Visual Studio 2012. I then try to run the program in debug mode for the first time. I then get an error that I have encountered in winforms, i.e Could not load file or assembly 'MySql.Web, Version=6.7.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies.

I have made sure that MySql.Web are added in references.

I have also added this to the Web.config

 <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.7.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
    </DbProviderFactories>
  </system.data>

As I'm new to ASP.NET, I have noticed that creating the project added a connection string that I did not specify in the Web.config.

  <connectionStrings>
    <add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=aspnet-SoundSource-20140312214649;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnet-SoundSource-20140312214649.mdf" providerName="System.Data.SqlClient" />
  </connectionStrings>

What do I need to do in order to view the home page on my browser correctly?

0

1 Answer 1

1

I recommend installing MySQL Installer, which includes MySQL Connector for .NET and MySQL for Visual Studio among other things. The Connector gives you the required assemblies to use with ADO.NET. With the Visual Studio plugin you can use Server Explorer to connect to MySQL server (and easily get the connection string). It also gives you Entity Framework designer support for MySQL.

When you add references to MySQL connector for .NET there are several assemblies you need to reference. Also there are several versions of each assembly - you need to reference correct ones. Look into that, it should help you with your problem.

1
  • I have used MySQL installer 5.6.15 for VS. I just uninstalled the program and then installed it again with the default installation. I think I may have just installed the server only previously. Anyway problem solved. I will mark your answer as correct because installing the right connector is essential especially with EF 5 and .NET 4.5. Commented Mar 12, 2014 at 21:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.