1

I'm getting the following error on all of my website's pages:

Server Error in '/' Application.

Parser Error

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. 

Parser Error Message: Failed to generate code. Could not load file or assembly 'MySql.Data, Version=6.6.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Source Error: 


Line 1:  <?xml version="1.0" encoding="utf-8"?>
Line 2:  <xs:schema id="newsarticles" targetNamespace="http://tempuri.org/news.xsd" xmlns:mstns="http://tempuri.org/news.xsd" xmlns="http://tempuri.org/news.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:msprop="urn:schemas-microsoft-com:xml-msprop" attributeFormDefault="qualified" elementFormDefault="qualified">
Line 3:    <xs:annotation>

Source File: /App_Code/news.xsd    Line: 1 

Assembly Load Trace: The following information can be helpful to determine why the assembly 'MySql.Data, Version=6.6.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' could not be loaded.

I checked the assemblies in my web.config, but no references to MySQL are there:

    <compilation debug="true" strict="false" explicit="true" targetFramework="4.0">
        <assemblies>
    <clear />
    <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
            <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
            <add assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
            <add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
            <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
            <add assembly="System.Data.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
            <add assembly="System.Data.Services.Client, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /></assemblies>
    </compilation>

I then checked the references of my website project. There I noticed a lot of different MySQL versions are referenced. I tried to delete all references but version 6.7.4.0, however, I can't even delete the references (see screenshot). enter image description here

I have these files in my bin folder, both of version 6.7.4.0:

MySql.Data.dll and MySql.Data.Entity.dll

How to fix this error?

1

1 Answer 1

1

try to add this to your web.config:

  <system.data>
    <DbProviderFactories>
      <remove invariant="MySql.Data.MySqlClient" />
      <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description="Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data" />
    </DbProviderFactories>
  </system.data>

Also, you don't need to reference any dlls from GAC. Just use nuget packages (MySQL.Data, MySQL.Web)

Sign up to request clarification or add additional context in comments.

Comments

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.