none
CS0246: The type or namespace name 'MySql' could not be found RRS feed

  • Pergunta

  • Hi,

    I´m configuring a Windows Server 2008 R2 with .net Framework 4.5.2 and lastest version of MySQL. I tried all the connectors avaliable for .net and in all versions I got the message "CS0246: The type or namespace name 'MySql' could not be found" when I tried to refer the library in coed behind.

    Someone could help me ?
    terça-feira, 26 de julho de 2016 11:34

Respostas

  • Some questions

    1) You are running on which version of IIS?
    2) Have you tried to change the trust level to Full Trust?
    3) Have you tried to add the following code in the Web.Config?

    <compilation debug="true" targetFramework="4.0">
          <assemblies>
            <add assembly="MySql.Data, Version=6.6.5.0, Culture=neutral, PublicKeyToken=C5687FC88969C44D"/>
          </assemblies>    
    </compilation>

    • Marcado como Resposta Giba Moraes terça-feira, 26 de julho de 2016 18:30
    terça-feira, 26 de julho de 2016 16:46

Todas as Respostas

  • Hi,

    See this post: http://www.codeproject.com/Articles/71346/Connecting-to-MySQL-Database-using-C-and-NET

    terça-feira, 26 de julho de 2016 12:13
  • Hi Andre, thanks for response.

    I think that is something on the server configuration.

    If I run on localhost or on a host like Azure works fine (http://webfocus.azurewebsites.net)

    But when I publish on my cloud server, the message apears... (http://200.98.167.211)

    terça-feira, 26 de julho de 2016 13:14
  • Verify if your "bin" folder contains the file "MySql.Data.dll".
    terça-feira, 26 de julho de 2016 13:51
  • Yes, there is a file named MySql.Data.dll on the bin folder
    terça-feira, 26 de julho de 2016 13:59
  • MySql is installed and running in your server?
    terça-feira, 26 de julho de 2016 14:47
  • Yes, and I can access it from my computer using MySQL Workbench.
    terça-feira, 26 de julho de 2016 16:14
  • Some questions

    1) You are running on which version of IIS?
    2) Have you tried to change the trust level to Full Trust?
    3) Have you tried to add the following code in the Web.Config?

    <compilation debug="true" targetFramework="4.0">
          <assemblies>
            <add assembly="MySql.Data, Version=6.6.5.0, Culture=neutral, PublicKeyToken=C5687FC88969C44D"/>
          </assemblies>    
    </compilation>

    • Marcado como Resposta Giba Moraes terça-feira, 26 de julho de 2016 18:30
    terça-feira, 26 de julho de 2016 16:46
  • I tried the code in step 3 and get an error.

    Then I remove the MySQL and install again.

    When I run again the application I got another error, then I change the version from 6.6.5.0 to 6.9.9.0 and install the Connector .net on the server.

    Now the error is gone, but the server is gone togheter...

    Service Unavailable


    HTTP Error 503. The service is unavailable.

    terça-feira, 26 de julho de 2016 17:33
  • IT WORKS!!!!!!

    For a any reason that I don´t know why, the app enters in a loop and crash down the server, making the application pool on the IIS to prevent stop.

    For any reason that I also don´t know why, the behavior of the app is diferent in my cloud server than the Azure server.

    But the important thing is that works...

    THANK YOU SO MUCH FOR SPENDING TIME WITH ME !

    []s

    terça-feira, 26 de julho de 2016 18:30
  • hello, maybe this post can help solve your problem.

    Integrating MySql to AspNet MVC with C #

    Se a resposta contribuiu com seu aprendizado por favor marque como Útil
    Se solucionou seu problema por favor marque como Resposta
    Atenção, se seu problema foi resolvido não deixe o post aberto 

    Visite : www.codigoexpresso.com.br 

    terça-feira, 26 de julho de 2016 21:53