ASP.Net Could not load file or assembly MySql.Data - mysql

I have a ASP.Net website that connects to a MySQL data base to retrieve data. I have used NuGet to install mysql.data. Doing this added a Bin folder with the sql.data dll in it to my project. It added a reference in my web config file. and it added a packages.config to my project. All of this is expected i assume ? With these resources in place my website works when i run it from visual studio. The problem is when i upload it to a server i get the following error :
Server Error in '/' Application.
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Could not load file or assembly 'MySql.Data, Version=6.9.8.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. The system cannot find the file specified.
Source Error:
An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
Source File: d:\DZHosts\LocalUser\bman262\www.brandonsLoginTest.somee.com\riviera horticulture\web.config Line: 7
Assembly Load Trace: The following information can be helpful to determine why the assembly 'MySql.Data, Version=6.9.8.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' could not be loaded.
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.1069.1
This is saying it cant find the mysql.data reference right ? What am i doing wrong ?
Here are some pictures of my solution in visual studio and my web.config
Solution
Web.config
I am tearing my hair out over this, any help would be VERY appreciated

→ You will have to make sure that the same version is installed on the server where you are deploying your project.
→ If the server to which you are deploying your project is on 64 bit, you can enable 32 bit support for this site's application pool, if your dll requires 32 bit architecture.

For anyone using similar or the same host as me if you have this problem the solution was to convert the project file to an application on the server.

Related

SSRS 2016: Report Delivery Extension to send report email via MicrosoftGraph&AzureIdentity, but error in assembly version of Microsoft.Identity.Client

Microsoft announced the expiration of Basic Authentication in Exchange Online except STMP AUTH, but no guarantee on using it for long term. So, I decide to start the change with our Reports delivery in SSRS 2016 which mainly via SMTP email right now.
After reading many sources, I found that SSRS has Report Delivery Extension which we can build assembly to customize new Delivery Method, and from here I can send the Report Email through Microsoft Graph & Azure Identity.
Link of delivery extension
In the Project, I added Nuget Package of:
Microsoft Graph package version 4.47
Azure Identity version 1.8
the VS automatically add other dependencies to project and I can build the project successfully without any Warnings or Error
However, deploying the assembly to SSRS, after the subscription runs, I got the error in the log as following:
notification!WindowsService_0!59ac!11/18/2022-16:42:08:: i INFO: Notification 27e69a92-12b9-4ab8-984f-d5910af77de7 completed. Success: True, Status: Error: Could not load file or assembly 'Microsoft.Identity.Client, Version=4.46.0.0, Culture=neutral, PublicKeyToken=0a613f4dd989e8ae' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
I check carefully the dependency of other assembly in nuget website, but nothing indicates that I'm using wrong version. The Microsoft.Identity.Client.dll file is copied to Bin folder of ReportServer.
I tried to update the Microsoft.Identity.Client.dll file with version 4.46.0 in nuget (ignore the dependencies), but another assembly version mismatch comes up:
notification!WindowsService_0!4d94!11/17/2022-23:59:03:: i INFO: Notification b82bb214-3880-4f80-857b-cdf42cde8ff0 completed. Success: True, Status: Error: Could not load file or assembly 'System.Diagnostics.DiagnosticSource, Version=4.0.4.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
And now, I could not find the System.Diagnostics.DiagnosticSource.dll with version 4.0.4.
I can only find version 4.0.0 or 4.3 above.
Now I'm stuck here.
Does anyone have experience on this?
How can I bypass this dependency check?
I even try to downgrade version of Azure.Identity version to lower one, but still stop at the System.Diagnostics version 4.0.4
Then I create a Console Application which I just send a test email with all latest version of assembly Azure.Identity and Microsoft.Graph on the same server (same .Net Framework 4.7.2 and same firewall configuration). It can be sent sucessfully.
I'm in doubt that SSRS 2016 has any assembly confliction which point to lower version of those assemblies.
I have the exact same problem, but with building an add-on for Act! for Windows. My code works outside Act! in a standalone .NET 4.7.2 app, but I get the exact same conflict as described above when loaded within Act!. That said, Act! itself doesn't even use Microsoft.Identity.Client (that dll is not part of it)

Upgade app from 'EntityFramework, Version=4.6.1.0 to Version 6.3.1 or greater

I have existing app that uses MySQL Server. Some errors I was getting when trying to add a new feature led me to upgrading to 'MySql.Data.EntityFramework 8.0.11'.
error I am getting when on:
public CitiesContext() : base("name=CitiesContext"):
An error occurred creating the configuration section handler for entityFramework: Could not load file or assembly 'EntityFramework, Version=4.6.1.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Under my properties, my target framework is still version 4.6.1.
Is there a 'how to document' somewhere on how to upgrade the EntityFrame work? I know several of the other installed packages were installed while targeting v 4.6.1, so lots of other types of errors using (like hay this was compiled with v 4.6) when trying to compile with a web.congf using
I have installed
PM> Install-Package EntityFramework -Version 6.4.4
Package 'EntityFramework.6.4.4' already exists in project 'Lat34North'
Time Elapsed: 00:00:00.0186347
Please note. This is a hobby for me, not a profession. The app is written using asp.net mvs an first issued in 2018. Do I just need to change the target in the properties and upgrade all the other packages??
Thank you for any help.

Advice needed: NewtonSoft.Json and Dynamics NAV 2009 R2 Classic

I'm trying to get the Codeunit 50000 in this zip file to work: https://kappiwebhosting.blob.core.windows.net/dynamcisis/2015/09/Json.zip
Found here: https://dynamics.is/?p=2303
C/AL Globals
I'm trying to get Dynamics Nav 2009 to recognize the NewtonSoft.Json.dll, but no matter which version i try, i get this error as soon i want to verify the DotNet variable "JsonTextReader"/"JsonTextWriter" when selecting the subtype.
.NET interop: exception occured, 'Could not load file or assembly 'Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.'.
If i declare a new Test variable of type DonNet and click [...] to select it from scratch i got this error when trying to choose which assembly to use:
.NET interop: exception occured, 'Could not load file or assembly 'C:\Program Files (x86)\Microsoft Dynamics NAV\60\Classic\Add-ins\Newtonsoft.Json.dll' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.'.
The Newtonsoft.Json.dll file is present ind the folder, and "Everyone" have full control to the folder as well as the file.
The Json.zip file contain a single Newtonsoft.Json.dll which i started out with. Same error. The i downloaded the https://github.com/JamesNK/Newtonsoft.Json/releases and tried all versions with the same result.
Why all this? Yes, the company i work for have decided to start using Shopify, and i need to write an interface for getting orders from Shopify etc.
I really cannot figure out why i can't get this to work. There are 3 other DotNet "variables" that's configured and works as intended with no errors.
So any advice is highly appreciated.
Thanx

Eception From HRESULT: 0*8013141a

I have made a desktop application for my project in my other laptop when i run this in my new laptop on same visual studio this shows following error:
could not load file or assembly 'MySql.Data, version=7.0.6.0, culture= neutral, PublicKeyToken=c5687fc88969c44d' or none of its dependencies. Strong name validation Filed. (Exception from HRESULT: 0*8013141a)
Please check below two issues and i think you tag should be changed because it is not directly mysql problem
Does the shortcut in the Start Menu set the working directory
correctly? (I suspect that this is the most likely answer)
Is there a different/incorrect version of MySql.Data.dll installed in
the GAC (Global Assembly Cache)? I've seen this give similar error
messages before.

'Could not load file or assembly 'Newtonsoft.Json, Version=6.0.0.0' error only when calling WCF REST method via the Internet

In our SharePoint 2013 Dev Machine, I have a WCF Rest web service that can be access via the a class library. The class library has the 'Newtonsoft.Json 6.0.5' installed successfully via nuget.org (Package Manager Console). The solution builds without any issue.
My SharePoint site has 2 way of being connected:
Local Network: When accessed this way, the WCF REST method call works smooth. I get the correct results as well.
Internet Access: We have alternative access mapping and when the WCF Rest method is called, I get the below mentioned error:
Message: Could not load file or assembly 'Newtonsoft.Json,
Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or
one of its dependencies. The system cannot find the file specified.
Note: Web application/bin folder has correct .dll version (6.0.5.17707)
Am I missing anything?
Found the solution:
I had extended my web application to map to the internet (Alternative access mapping), which meant that I had a new bin folder for the new port. Once I copied and pasted the Dlls to the new bin. The error vanished.