I compiled the whole project with x86 platform target. It is working fine when I copy .exe and the reference dlls on to the server and run .exe from server cmd window.
Our requirement is to copy the exe and dlls onto some network path and execute the exe on the server using UNC path. When I execute using UNC path, I am getting the error:
Unhandled Exception: System.BadImageFormatException: Could not load
file or assembly 'XXXX, Version=3.0.10.19399, Culture=neutral,
PublicKeyToken=null' or one of its dependencies. An attempt was made
to load a program with an incorrect format.
File name: 'XXXX, Version=3.0.10.19399, Culture=neutral, PublicKeyToken=null'
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].
Can someone help?
I'm just guessing now, but I would probably blame the path itself - it's most likely "untrusted", reason unknown. Enable Assembly Bind Logging (tip: google :) ) to figure out what's happening
Related
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.4.4.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: G:\PleskVhosts\dekhoroom.com\httpdocs\web.config Line:
11
Assembly Load Trace: The following information can be helpful to
determine why the assembly 'MySql.Data, Version=6.4.4.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].
If you, on your local development machine, have MySql.Data in your GAC, it will not be in your Web app's bin directory. And if it is that bin directory that gets deployed, Sql.Data will not be there. Do not expect a hosting provider to have all kinds of assemblies in the GAC.
So the solution is to deploy all the assemblies your Web app needs. Deploy MySql.Data, and any other assemblies that it depends upon, along with your Web application.
For the same reason, it is a good idea not to install ASP.NET MVC in your GAC but to simply reference it and deploy it along with your Web application.
Seems like there are already 100s of questions like these.. I have search through quite many of them and they don't seem to suggest anything that I haven't tried yet.
I get the error:
Could not load file or assembly 'System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Access is denied.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.IO.FileLoadException: Could not load file or assembly 'System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Access is denied.
Source Error:
Line 44: private static IKernel CreateKernel()
Line 45: {
Line 46: var kernel = new StandardKernel();
Line 47: try
Line 48: {
The above code is present in my Ninject Initializer.
I have given "Everyone" Permissions on:
C:\Windows\Microsoft.NET\Framework\v4.0.30319
C:\Windows\Microsoft.NET\Framework64\v4.0.30319
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\ .NETFramework
FusionLog Details:
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable C:\Program Files (x86)\IIS Express\iisexpress.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: DisplayName = System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
(Fully-specified)
LOG: Appbase = file:///F:/TFS/MMSChange/Main/SMRH.MMSChange/SMRH.MMSChange.Web/
LOG: Initial PrivatePath = F:\TFS\MMSChange\Main\SMRH.MMSChange\SMRH.MMSChange.Web\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Found application configuration file (F:\TFS\MMSChange\Main\SMRH.MMSChange\SMRH.MMSChange.Web\web.config).
I have also given everyone permissions on my code's folders. I have tried running ProcMon (which has helped me with the similar problems for different solutions before); but it does not create a single entry for system.web.dll.
I have impersonation built in. I use separate accounts to access the database and that impersonation for the database account breaks this. Without impersonation the app runs fine. (But has no data because all the db calls fail)
Funny thing is though, if I deploy the same code to my local machine and run it via an IIS Web Site: it works. But if I just debug it from my IDE it fails.
I got another instance of ProcMon running and filtered results to show only IISExpress results (Since this is the one which is giving me error).
Then I compiled and launched my application from the IDE and waited for the error to come. After I got the error, I filtered the results by "Access Denied".
Usually I filtered the results to look for system.web.dll, but this time i decided to ignore it.
I found that the only file which was throwing access denied was: "C:\Users\1roj1\Documents\IISExpress\config\aspnet.config" (Where 1roj1 is my user account).
I gave my impersonate user full access to this file and voila everything worked!
I think you need to register .net Freamework 4.0 for IIS for the above issue.
Here are the steps..
Open Command prompt as Administrator
Navigate to "C:\Windows\Microsoft.NET\Framework\v4.0.30319" directory in command prompt
[use the command cd C:\Windows\Microsoft.NET\Framework\v4.0.30319]
Register .net FrameWork for IIS
[use command aspnet_regiis.exe -i]
Restart IIS [use command iisreset].
Done.
While trying to execute my web application, it throws the following error. It says Matrix.Data.dll could not load. I tried to rebuild the assembly and reference it again. But no use. Also, it is showing a warning 'Assembly binding logging is turned OFF' and what will be the performance penalty associated with assembly bind failure logging...?
Error in detail:
System.IO.FileLoadException: Could not load file or assembly 'Matrix.Data, Version=5.0.3.16,
Culture=neutral, PublicKeyToken=ed19106b2f44b5a8' or one of its dependencies.
The located assembly's manifest definition does not match the assembly reference.
(Exception from HRESULT: 0x80131040)
File name: 'Matrix.Data, Version=5.0.3.16, Culture=neutral,
PublicKeyToken=ed19106b2f44b5a8'
at Matrix.Administration._Administration.DoRequest(Boolean& plReplacePlaceholders)
at Matrix.AppServerHTTPHandler.doRequestDefault()
in D:\FX\AppServer\Appserver.vb:line 443
at AppServer.AppServerHTTPHandler.doRequest(Kernel pKernel)
in D:\FX\AppServer\Appserver.vb:line 373
at AppServer.AppServerHTTPHandler.processRequest(HttpContext context)
in D:\FX\AppServer\Appserver.vb:line 107
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].
Your Accessibility.dll is most likely corrupted. You will not be able to delete the file, even as Administrator.
You must go into the security settings and change the owner from TrustedInstaller to a different user and give yourself permissions on the file. Once done, get an Accessibility.dll from a working computer and replace your corrupted version.
Best I can guess, an installer from Microsoft corrupted the DLL as no user has permission to edit/delete/replace files owned by TrustedInstaller.
I have been using log4Net to write in a text file when there is any exception in my web service, this was working but today it started to throw error.
System.Web.Services.Protocols.SoapException: Server was unable to
process request. ---> System.TypeInitializationException: The type
initializer for.. threw an exception.
---> System.IO.FileLoadException: Could not load file or assembly
'log4net, Version=1.2.9.0, Culture=neutral,
PublicKeyToken=b32731d11ce58905' or one of its dependencies. The
located assembly's manifest definition does not match the assembly
reference. (Exception from HRESULT: 0x80131040)
File name: 'log4net, Version=1.2.9.0, Culture=neutral,
PublicKeyToken=b32731d11ce58905'
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].
If you have any inputs on this stack info, pls. share it.
Did you change the code, or did this just start happening?
I've seen this error occur when the target processor architecture was mismatched. Did you change that by any chance?
If this isn't the case, and you have Windows SDK installed, you can use the Fusion Log Viewer to view assembly binding logs. The utility should be installed on your machine.
My Application does not allow Interop.CDO to download a file from FTP server, what can I need to do to resolve this issue?
Error message :
Could not load file or assembly
'Interop.CDO, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null'
or one of its dependencies. Была
сделана попытка загрузить программу,
имеющую неверный формат.
Here's the English equivalent of the error:
An attempt was made to load a program with an incorrect format.
Can you check it's not a 32/64 bit issue? The underlying COM CDO dll is probably only supporting 32-bit processes. Your program maybe compiled as "x64" or as "Any CPU", but running on a 64-bit Windows.