locked
EntityFramework 4.2 not uploaded to Azure cloud service instance (Connecting to MySQL DB) RRS feed

  • Question

  • User1604015986 posted

    I have a asp.net C# web application built in VS2010. I am using a MySQL database hosted on Amazon RDS, and Windows Azure to host the cloud service instance. 

    My application is targeting .NET Framework 4.0, and I have installed EntityFramework 4.2 via Nuget package manager. I am using the MySQL Connector .Net v6.9.4. 

    I run it fine on my local PC, the EntityFramework package seems to have been installed correctly. When I publish the project it to Azure, however, the EntityFramework DLL is not located in the 'bin' folder on the Azure VM. I am publishing it via VS2010 by right clicking on the project and choosing 'Publish' from the context menu. 

    In my web.config, I have:

        <dependentAssembly>
            <assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
          </dependentAssembly>


    And in the packages.config for the project I am referencing the EF, I have:

    <packages>
          <package id="EntityFramework" version="4.2.0.0" targetFramework="net40" />
        </packages>

    but when I try to run my aplication from the cloud, I get the following error:

        Could not load file or assembly 'EntityFramework, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified.

    Which is quite obvious that it can't be found as it is not being uploaded, for some reason... Why? I have 'Copy Local' set to true for all references of the EF DLL, so am pretty confused why it's not being uploaded to the web instance. Can anyone think of a reason as to why this is not being uploaded to the Azure instance? Is there something I've missed (which is quite possible, I'm a novice when it comes to web app dev)?

    NOTE: This project previously used MSSQL as the database, was using the same version of EF and always worked. But I've had to migrate it to use MySQL (company decision) and now I am facing this issue..

    Wednesday, December 10, 2014 8:03 AM

Answers

  • User541108374 posted

    Hi,

    I can only choose the 'publishsettings' downloaded via Azure portal to Import as my subscription.

    Did you do so? You can download it from the management portal and use it in this dialog.

    Grz, Kris.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, December 15, 2014 3:56 AM

All replies

  • User541108374 posted

    Hi,

    if you manually upload the dll files to the /bin folder does it work then?

    Also try to webpublish to your local folder and see if it gets put in there as well or not.

    Grz, Kris.

    Friday, December 12, 2014 3:26 AM
  • User1604015986 posted

    Hi Kris,

    I don't know how to manually upload the file to the azure cloud instance, or webpublish to my local folder.. I am a novice at web app development, really.

    I am publishing it via VS2010, right clicking on the Azure project node and selecting 'Publish' from the context menu. This is how I had always done it, and when I was initially using SQL Azure as the database, the same EntityFramework DLL was being used and it was being uploaded fine. This problem only surfaced when I switched the DB to MySQL.

    Cheers,

    Chris

    Friday, December 12, 2014 5:38 AM
  • User541108374 posted

    Hi,

    normally you could rdp to the server or make use of ftp to upload it.

    Do a clean build of your application, then rebuild everything again and try uploading it again.

    Grz, Kris.

    Friday, December 12, 2014 5:42 AM
  • User1604015986 posted

    Hi Kris,

    I manually added the entityframework DLL to the 'bin' folder using RDP (thanks for that tip!). But I then got another error when trying to run the application:

    Unable to find the requested .Net Framework Data Provider.  It may not be installed.


    Which lead me to this solution:
     http://forums.mysql.com/read.php?38,590269,590290#msg-590290

    Now my application works, when I manually copy the entityframework.dll to the azure instance, and it can access the database.

    But any idea on why is this DLL not being upoaded when I publish via VS2010? I don't want to have to manually copy the DLL every time I publish some changes...

    Many thanks for your help so far! I've posted this on a few different forums over the last two weeks or so and you're the first person to reply!

    Cheers,

    Chris

    EDIT: Clean build & republish doesn't change anything, btw! EntityFrameworkDLL still not published automatically.

    Friday, December 12, 2014 6:43 AM
  • User541108374 posted

    Hi,

    did you try web deploy or FTP from within VS2010? You could try to get rid of the configuration and create a new profile.

    For FTP you can do like this:

    Grz, Kris.

    Friday, December 12, 2014 7:55 AM
  • User1604015986 posted

    Hi Kris,

    No, I haven't tried to FTP from within VS2010, as Azure does not natively support it AFAIK.

    I deployed via VS2010. The main project is a Windows Azure Cloud Service. When I right click on the solution node and select 'Publish' from the context menu, I don't get the same dialog as the one you've posted, I see the 'Publish Windows Azure Application' dialog, below.

    I can only choose the 'publishsettings' downloaded via Azure portal to Import as my subscription.

    Friday, December 12, 2014 9:23 AM
  • User541108374 posted

    Hi,

    I can only choose the 'publishsettings' downloaded via Azure portal to Import as my subscription.

    Did you do so? You can download it from the management portal and use it in this dialog.

    Grz, Kris.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, December 15, 2014 3:56 AM