I'm using Visual Studio 2012, created a web-service that add/select data from Microsoft axapta 2009, when trying to add data I get the following error
Could not load file or assembly 'Microsoft.Dynamics.BusinessConnectorNet, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
I've tried changing the project type to only x86 output and changed IIS server app pool settings to only x86. nothing worked for me
After searching for almost a week for a solution. the answer was in removing the reference of the connector from the front-end project and copying the business's connector to bin folder
This particular webapplication required the IIS to run in 64 bit mode and therefore this was changed. The Microsoft.DynamicsBusinessConnectorNet.dll that I was using was the 32bit version – which ofcourse was the cause of the error.
The solution was to enable the application pool to allow 32 bit application at IIS. This is done by:
Right clicking the application pool and selecting “advanced setting”
Set the “enable 32-bit applicataions” to true
Related
I am using PdfSharpCore version 1.3.40 in a MVC ASP.Net netcoreapp2.1 and it works perfectly on my windows localhost, but when I publish it on a server Linux running Apache the follow exception occurs:
Could not load file or assembly 'PdfSharpCore, Version=1.3.40.0, Culture=neutral, PublicKeyTo ken=null'. The system cannot find the file specified.
I already checked that the PdfSharpCore dll is there, but the system couldn't find it.
Does anyone know what's going on?
We managed to solve the problem, we were forgetting to replace the .deps.json file that contains the dependencies with the new PdfSharpCore.dll dll included in the project. Solved!
I have a .csproj that I want to publish to a clickonce server.
When I publish the application from one development computer it works and the program can be started from the server without any problems.
I download the same project from svn to another computer and try to publish it. That step kinda works, i guess, since the program is published successfully without any errors.
But when I try to start the program from the server I get the error:
Application requires that assembly office version 12.0.0.0 be installed in the Global Assembly Cache(GAC) first.
Update: (also posted info in comments). I am receiving this warning on both machines though I don't know how to solve. But it's probably the cause of the problem I guess:
No way to resolve conflict between "office, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" and "office, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c". Choosing "office, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" arbitrarily.
1> Consider app.config remapping of assembly "office, Culture=neutral, PublicKeyToken=71e9bce111e9429c" from Version "12.0.0.0" [C:\Windows\assembly\GAC\office\12.0.0.0__71e9bce111e9429c\office.dll] to Version "14.0.0.0" [D:\Visual Studio\Visual Studio Tools for Office\PIA\Office14\office.dll] to solve conflict and get rid of warning.
So I finally solved this.
First I thougt I'd describe how the project looked. Under references there was no reference to the office.dll file though this actually ended up in the published directory when computer1, which was able to publish a working copy, published the project. Also under properties->publish->ApplicationFiles the office.dll was listed as exluded.
computer2, which couldn't publish a working project, had the same installed programs as computer1. So I tried to add the reference to office.ddl, set it to copy local and include it in applicationfiles. Now there was a office.dll copied to the published directory but the same error appeared. installed and re-installed a bunch of programs, no improvement. After I've been trying alot of randomstuff I ended up copying the dll from computer1, referenced it, set it to copy local and included it. And, voila, it worked?
The problem:
When deploying my applications to the production database i get the following error:
Could not load file or assembly 'System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified.
at ConsoleApplication2.Database.DBConnect.Initialize(String username, String password, String IP)
at ConsoleApplication2.Database.DBConnect..ctor(String username, String password, String IP) in C:\Users\Vincent\Documents\Visual Studio 2008\Projects\ConsoleApplication2\ConsoleApplication2\DBConnect.cs:line 26
at ConsoleApplication2.Database..ctor() in C:\Users\Vincent\Documents\Visual Studio 2008\Projects\ConsoleApplication2\ConsoleApplication2\Database.cs:line 20
at ConsoleApplication2.Main..ctor() in C:\Users\Vincent\Documents\Visual Studio 2008\Projects\ConsoleApplication2\ConsoleApplication2\Main.cs:line 16
What i know: it isn't actually the System.Data.dll that has a problem.
Since I've started making a clean console application.
First just using Console.write(). when that worked i made a new class and did some general computations (also without problems) than I decided to create a MySQL connection using the MySQL.data.MySqlClient; from the Mysql.data.dll this is when the error occured again. I got the dll from the mysql site.
the strange part:
this dll has always worked on my computer (on which I created the applications) and on 2 different servers (1 of which I set up just for testing these applications to see if i would get the same problem)
some specs:
my computer runs windows 7 32 bit.
the production database runs windows 2003 service pack 2 as do the test server and the other server I've tried it on.
Some other stuff I've done:
I have created an installer (.msi and .exe) both install .net 3.5 service pack 1 and .net 2.0 service pack 2.0 and .net 3.0 service pack 2.
i found it strange that it would install all those .net frameworks but to install 3.5 you need 2.0 so that made sense (not sure about why it installed 3.0 though)
I've also tried running the application without the MySQL connector installed (so just place the mysql.data.dll in the application folder) and I've tried with the MySQL connector installed (so no dll's in the application folder)
I've tried copying my .net framework to the production database (this was before i knew it was about the mysql.data.dll and not the system.dll or system.data.dll)
I've tried everything i could think of yet nothing works, it works fine on all other computers/databases just not on the 1 we want to deploy the application...
The code where the error occurs:
public DBConnect(string username, string password, string IP)
{
Console.WriteLine("dbconnect contsrutctor");
Initialize(username, password, IP);
}
private void Initialize(string username, string password, string IP)
{
Console.WriteLine("initializing strings");
string server = IP;
string database = "";
string connectionString;
connectionString = "SERVER=" + server + ";" + "DATABASE=" +
database + ";" + "UID=" + username + ";" + "PASSWORD=" + password + ";";
Console.WriteLine("initializing mysqlconnection");
//MySqlConnection connection = new MySqlConnection(connectionString);
}
i have commented the line:
MySqlConnection connection = new MySqlConnection(connectionString);
and the applications runs without errors, when I un-comment it the error occurs again.
EDIT
I have noticed a strange thing: when ever it gets to the method (not the line) of where the MySqlConnection is created the error is thrown. If you would look at the above code sample the first Console.WriteLine("initializing strings"); does not even show in my console. I find this quite strange since you would expect the error to be thrown on the MySqlConnection connection = new MySqlConnection(connectionString); line and not at the start of the method.
EDIT 2
I thought i found an answer so i posted it:
"Though i have checked the system.data.dll and system.dll versions and
file paths (which were exactly the same on all 3 machines I did find
the problem to be with these files.
In my application I've set the "copy local" to true and after this it
worked.
I find this extremely odd since I've tried replacing the dll's on the
production server with my own and this did not work. also just placing
the dll's in the application folder did not help either. I had to
specifically specify the application to copy the dll's it self.
anyway it's working properly now although I'm not quite convinced i
like this solution...
I definitely do not like this because i need to do this to half of the
dll's (yes half not all just about half of them).
any better options are still welcome."
however I failed to mention it worked on my test application, the real application can't find system.transactions this time. so it's still not the right solution though it did clear the error about the system.data.dll i still can't run the program because of a similar error for a different file.
So since i'm still having the same error but on a different file (which i can't change the "copy local" setting to true since it's not referenced by me) i've deleted the answer and placed it here as an edit since the problem still isn't solved.
EDIT 3
I've run Fuslogvw.exe and this is the result:
* Assembly Binder Log Entry (12/5/2013 # 8:43:13 AM) *
The operation failed. Bind result: hr = 0x80070002. The system cannot
find the file specified.
Assembly manager loaded from:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll Running
under executable C:\Program Files\Custommate\email sorteer
service\EmailSorteerService.exe
--- A detailed error log follows.
=== Pre-bind state information === LOG: User = NAVMATE\Administrator LOG: DisplayName = System, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089 (Fully-specified) LOG: Appbase =
file:///C:/Program Files/Custommate/email sorteer service/ LOG:
Initial PrivatePath = NULL LOG: Dynamic Base = NULL LOG: Cache Base =
NULL LOG: AppName = NULL Calling assembly : EmailSorteerService,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
=== LOG: This bind starts in default load context. LOG: No application configuration file found. LOG: Using machine configuration file from
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Post-policy reference: System, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089 LOG: GAC Lookup was unsuccessful. LOG:
Attempting download of new URL
file:///C:/Program
Files/Custommate/email sorteer service/System.DLL. LOG: Attempting
download of new URL
file:///C:/Program Files/Custommate/email sorteer
service/System/System.DLL. LOG: Attempting download of new URL
file:///C:/Program Files/Custommate/email sorteer service/System.EXE.
LOG: Attempting download of new URL
file:///C:/Program Files/Custommate/email sorteer service/System/System.EXE. LOG: All
probing URLs attempted and failed.
Meaning it's trying to load the dll's from the folder i'm running the application from, i find this strange since i don't know what is causing this. (I have made sure copy local is set to false so that couldn't be the problem)
so the new question: how do i make sure it loads it from the right place?
The reason why the exception is thrown as soon as you enter the method is simple - the JIT compiler only needs to resolve the references then. MySqlConnection requires System.Data, and it's the first method to do so, so that's when the exception is thrown.
As for debugging the issue, it does seem like improperly installed .NET framework on the target machine. You should try How to enable assembly bind failure logging (Fusion) in .NET to have a look at where .NET is actually trying to find the library, and why it discards any that it finds at all.
If it doesn't lead you to solve your problem, I'd try uninstalling and reinstalling .NET framework 2.0, and then 3.5.
The reason Copy Local sort of works is because then the application doesn't try to load the DLL from the Global Assembly Cache, but rather from the executable directory of your application. However, your real problem is that it isn't finding the right DLL in GAC.
If Fusion shows you that the MySQL library tries to load a wrong version of System.Data, you can use an application manifest to force it to load a different version (which should hopefully be compatible). You can read about application manifests here - http://msdn.microsoft.com/en-us/library/aa374191(VS.85).aspx
Good luck.
Whenever I have seen issues like this, it is because I have not deployed the correct version of the library in question or because I am actually missing a library. I think others already referenced this but I wanted to repeat to emphasize that this is the main issue.
In order to solve these sorts of issues you can do two things. First, understand the order in which libraries are loaded:
Look in the Global Assembly Cache (GAC)
Search the folder your program is running from
Search the current directory
Search the system folder (System32 or SysWow64)
Search any other folders in the environment %PATH% variable
Once you understand that, you can look in each of these locations for wrong or conflicting versions of the library that you are referencing. Since System.Data is a library that comes with .NET I would guess that your build computer has a different version of .NET installed than you have on your computer you are trying to deploy to.
The other thing that I have found to be really helpful is a tool called fuslogvw.exe (http://msdn.microsoft.com/en-us/library/e74a18c4(v=vs.110).aspx). If you follow the instructions on the FusionLog site you can trace .NET as it tries to load various assemblies. Simply enable the tool then check the logs file after you get the error. This should indicate where .NET was looking for the file and possibly why it failed.
As others said - best of luck!
To find a which .dll it is ultimately failing to find ("or one of its dependencies" in the error message) and from where it is attempting to load it you can try Process Monitor from the SysInternals suite.
It's a simple download, unzip, and run in place. I suggest you then add a filter for your app's name (or whatever else you can use to uniquely identify it) and then just watch for it to try to load a .dll and fail. You can apply more filters to narrow down the list of events such as Operation is QueryNameInformationFile (first event it tries when locating a file). Note that for a lot of .dlls it will try a few places before ultimately finding a copy, so you're looking for a series of events referencing the same file name with no Success result at the end.
Best of luck.
I had this error when Windows update was installing .Net 4.5.2 at the same time I was debugging my code in 4.5.1.
I had the same problem,
First, you must copy your reference dll file into the bin folder of the main project that uses it and include the file at the references section of the main project inside VS.
Second, if you are using your main project as a library project and including it inside another project (a second project) then add the same reference dll file into the bin folder of this second project and also include this copied file at the references section of the second project at VS.
This workaround solved my problem, I hope it helps you too.
I'm getting following exception on a production machine for a Windows desktop app:
Could not load file or assembly 'System.Data, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its
dependencies. File is corrupt. (Exception from HRESULT: 0x8013110E)
I understand there can be multiple reasons like platform mismatch, targeted .net framework mismatch, etc. But, what tools/checks can I run on production machine to pin-point the cause?
The fact is that the app is in 64-bits. So look into that and find an option in the advanced settings of an app pool in IIS7, named "Enable 32-Bit Applications".
After setting it to true, everything will normally work.
Note: If you want to use this in IIS6, be aware that IIS6 does not support this on a "per app pool" basis. So if you set IIS6 to 32 bit, all its app pools will run in 32 bit mode. If you want to set this on a "per app pool" basis, you will have to upgrade to IIS7.
To set IIS6 to 32 bit, do the following:
Open a command prompt and navigate to the
%systemdrive%\Inetpub\AdminScripts directory.
Enter the following command:
cscript.exe adsutil.vbs set W3SVC/AppPools/Enable32BitAppOnWin64 "true"
It seems that in some cases, the "true" from the above command needs to be replaced with a 1.
Sometimes it is also necessary to reset IIS.
I have an issue when trying to load the NServiceBus assembly from a client machine. The software runs correctly from my development box but once rolled out I get the following error:
Could not load file or assembly 'NServiceBus, Version=2.0.0.1100, Culture=neutral, PublicKeyToken=9fc386479f8a226c' or one of its dependencies. The system cannot find the file specified.
The weird thing is I am not using version 2.0.0.1100, I am using the latest version 2.0.0.1219. It seems to be referencing the old version somewhere but I cannot find where. I have set the “Specific Version” flag to true on both the NServiceBus & NServiceBus.Core assemblies and have tried to explicitly set the version number in the app config, both with no luck. I don’t understand why it works fine locally but errors once rolled out. The project causing the error is a shared class library and it only appears to be erroring on some projects too.