ASP.NET - C# Could not load file or assembly 'Eyelock.Eye.Matching'

1

I have been working a project that uses a hardware device Eyelock using Eyelock C# SDK. I tried to import the C# references to ASP.net C#. During compiling the project, there is no problem with it, but during runtime, there is an error that making the project won't run.

Here is the whole error log:

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 'Eyelock.Eye.Matching' or one of its dependencies. Strong name signature could not be verified.  The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key. (Exception from HRESULT: 0x80131045)

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Assembly Load Trace: The following information can be helpful to determine why the assembly 'Eyelock.Eye.Matching' could not be loaded.


=== Pre-bind state information ===
LOG: User = Nox-PC\Nox
LOG: DisplayName = Eyelock.Eye.Matching
 (Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: Eyelock.Eye.Matching | Domain ID: 2
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///C:/inetpub/wwwroot/test1/test1/
LOG: Initial PrivatePath = C:\inetpub\wwwroot\test1\test1\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\inetpub\wwwroot\test1\test1\web.config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Users/Nox/AppData/Local/Temp/Temporary ASP.NET Files/root/22b543dd/2d61a40f/Eyelock.Eye.Matching.DLL.
LOG: Attempting download of new URL file:///C:/Users/Nox/AppData/Local/Temp/Temporary ASP.NET Files/root/22b543dd/2d61a40f/Eyelock.Eye.Matching/Eyelock.Eye.Matching.DLL.
LOG: Attempting download of new URL file:///C:/inetpub/wwwroot/test1/test1/bin/Eyelock.Eye.Matching.DLL.
LOG: Using application configuration file: C:\inetpub\wwwroot\test1\test1\web.config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: Eyelock.Eye.Matching, Version=2.6.4938.11802, Culture=neutral, PublicKeyToken=cf75d5be912e9930
ERR: Failed to complete setup of assembly (hr = 0x80131045). Probing terminated.

Stack Trace:


[FileLoadException: Could not load file or assembly 'Eyelock.Eye.Matching' or one of its dependencies. Strong name signature could not be verified.  The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key. (Exception from HRESULT: 0x80131045)]

[FileLoadException: Could not load file or assembly 'Eyelock.Eye.Matching, Version=2.6.4938.11802, Culture=neutral, PublicKeyToken=cf75d5be912e9930' or one of its dependencies. Strong name signature could not be verified.  The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key. (Exception from HRESULT: 0x80131045)]
   System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
   System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +39
   System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks) +132
   System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +144
   System.Reflection.Assembly.Load(String assemblyString) +28
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +46

[ConfigurationErrorsException: Could not load file or assembly 'Eyelock.Eye.Matching, Version=2.6.4938.11802, Culture=neutral, PublicKeyToken=cf75d5be912e9930' or one of its dependencies. Strong name signature could not be verified.  The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key. (Exception from HRESULT: 0x80131045)]
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +618
   System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +209
   System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +130
   System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +178
   System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() +94
   System.Web.Compilation.BuildManager.CallPreStartInitMethods() +332
   System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +677

[HttpException (0x80004005): Could not load file or assembly 'Eyelock.Eye.Matching, Version=2.6.4938.11802, Culture=neutral, PublicKeyToken=cf75d5be912e9930' or one of its dependencies. Strong name signature could not be verified.  The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key. (Exception from HRESULT: 0x80131045)]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9090988
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +97
   System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +258

Any responses are very much appreciated! Thanks!

c#
asp.net
sdk
hardware

2 Answers

0

Make sure that the DLL is Copy Local = True and make sure the DLL is in the bin.

Then check to see if the DLL has any references that also need to be copied to your bin directory.

answered on Stack Overflow Dec 30, 2013 by Adam
0

I had a similar problem and had to sign the DLL. In your case it looks like the signature has either been tampered with or damaged. So I would say do this at your own risk.

You can take the DLL and generate an IL file using the following command in VS.NET Command Prompt:

ildasm /all /out=Eyelock.Eye.Matching.il Eyelock.Eye.Matching.dll

This should create the IL file. Now you need to reconstruct the DLL and sign it with your key, as such:

ilasm /dll /key=YourKey.snk Eyelock.Eye.Matching.il

This will generate a DLL that is signed with your key.

Few things to keep in mind:

  1. Signing a third party DLL with your key could be risky. Make sure you are using something from a trustworthy source.
  2. The DLL referenced may or may not be the problem child. It could be another assembly ( DLL ) that it references that is not signed properly.
answered on Stack Overflow Mar 5, 2014 by virtualadrian

User contributions licensed under CC BY-SA 3.0