Cannot run afterbuilding new laptop

Posts   
 
    
dazedorconfused avatar
Posts: 89
Joined: 06-Apr-2006
# Posted on: 09-Sep-2009 15:37:27   

Hi, My development laptop crashed and I was forced to build a new one from scratch. I had all my data backed up, so no code loss... just have to rebuild the environment. I have reinstalled everything, but I cannot get my projects that use DB2 to run. I have installed LLBLGen Pro 2.5 Final. I am using Visual Studio 2005. I reinstalled the DB2 Client Lite. The version of the IBM.Data.DB2 assembly is 8.1.2.1. Since I am forced to use the 8.x db2 client, in followed the steps in the "What's new" section of the documentation.

by copying the dll in that folder into the folder LLBLGen Pro Installation folder\Drivers\DB2, overwriting the existing one (if you want to preserve that one, create a backup copy in another folder). Also, in the generated code, use the IBM DB2 DQE in the folder LLBLGen Pro Installation folder\RuntimeLibraries\DotNetxy\IBMDB2v8121

Now that all of this is done, I get the following error when attemting to run my ASP.Net project. I also get an error when attempting to create a new DB2 project. I have attached a screenshot of the error.

Could not load file or assembly 'IBM.Data.DB2' 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 'IBM.Data.DB2' 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 'IBM.Data.DB2, Version=8.1.2.1, Culture=neutral, PublicKeyToken=7c307b91aa13d208' 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.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +0 System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +43 System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +127 System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +142 System.Reflection.Assembly.Load(String assemblyString) +28 System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +46

[ConfigurationErrorsException: Could not load file or assembly 'IBM.Data.DB2, Version=8.1.2.1, Culture=neutral, PublicKeyToken=7c307b91aa13d208' 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) +613 System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +203 System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +105 System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +178 System.Web.Compilation.BuildProvidersCompiler..ctor(VirtualPath configPath, Boolean supportLocalization, String outputAssemblyName) +54 System.Web.Compilation.ApplicationBuildProvider.GetGlobalAsaxBuildResult(Boolean isPrecompiledApp) +227 System.Web.Compilation.BuildManager.CompileGlobalAsax() +52 System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +337

[HttpException (0x80004005): Could not load file or assembly 'IBM.Data.DB2, Version=8.1.2.1, Culture=neutral, PublicKeyToken=7c307b91aa13d208' 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.Compilation.BuildManager.ReportTopLevelCompilationException() +58 System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +512 System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters) +729

[HttpException (0x80004005): Could not load file or assembly 'IBM.Data.DB2, Version=8.1.2.1, Culture=neutral, PublicKeyToken=7c307b91aa13d208' 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) +8890735 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +85 System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +259

Attachments
Filename File size Added on Approval
LLBLGenDB2Error.GIF 27,289 09-Sep-2009 15:59.16 Approved
Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 09-Sep-2009 17:10:37   

[FileLoadException: Could not load file or assembly 'IBM.Data.DB2'

The following was also mentioned in the manual, in the** Generated code - Compiling the code** section.

For IBM DB2 UDB, you need to have the IBM DB2 .NET provider installed and you need to reference IBM.Data.DB2.dll, shipped with the latest ClientAccess software for DB2 or with the DB2 UDB personal edition v8.1.x or higher. It can be your IBM.Data.DB2.dll version is older than the one we used to build the DB2 DQE. If that's the case please change the reference to the proper IBM.Data.DB2 assembly.

dazedorconfused avatar
Posts: 89
Joined: 06-Apr-2006
# Posted on: 09-Sep-2009 17:22:55   

I have installed the Run-Time Client Lite that is linked to from the 2.5 downloads page. I have also referenced IBM.Data.DB2 at C:\Program Files\IBM\SQLLIB\BIN\netf11\IBM.Data.DB2.dll which is where the installer put it. My solution will build fine, but when I try to run it I get the error. Also, I cannot create new DB2 projects in the designer. I attached to error to my original post.

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 09-Sep-2009 17:33:10   

For the designer error, most probably you need an assembly bindingRedirect in the LLBLGenPro.exe.config file.

Please check the following thread, it has some useful detauls regarding the DB2 driver: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=10398

dazedorconfused avatar
Posts: 89
Joined: 06-Apr-2006
# Posted on: 09-Sep-2009 23:53:33   

I have no idea what I would use for the publicKeyToken. I don't think I had to do this on my last laptop. If I look at the properties of the IBM.Data.Dll assembly,the File Version is 8.1.17.1 and the assembly version is 8.1.2.1. I think the File Version of the dll on my old laptop was 8.1.14.1 but the assembly version is the same (8.1.2.1) I enabled fusion logging and the results are below. The wierd thing is that the dll is present in one of the folders that it is looking in... C:\dev\PackGen\services\bin. I am stuck and I don't know what to try next.

Assembly manager loaded from:  C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll
Running under executable  C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\WebDev.WebServer.exe
--- A detailed error log follows. 

=== Pre-bind state information ===
LOG: User = nam\E0134
LOG: DisplayName = IBM.Data.DB2
 (Partial)
LOG: Appbase = file:///C:/dev/PackGen/services/
LOG: Initial PrivatePath = C:\dev\PackGen\services\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\dev\PackGen\services\web.config
LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\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:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/root/c700d210/7aa1c634/IBM.Data.DB2.DLL.
LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/root/c700d210/7aa1c634/IBM.Data.DB2/IBM.Data.DB2.DLL.
LOG: Attempting download of new URL file:///C:/dev/PackGen/services/bin/IBM.Data.DB2.DLL.
LOG: Using application configuration file: C:\dev\PackGen\services\web.config
LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Post-policy reference: IBM.Data.DB2, Version=8.1.2.1, Culture=neutral, PublicKeyToken=7c307b91aa13d208
ERR: Failed to complete setup of assembly (hr = 0x80131045). Probing terminated.

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 10-Sep-2009 11:55:52   

I have no idea what I would use for the publicKeyToken

LOG: Post-policy reference: IBM.Data.DB2, Version=8.1.2.1, Culture=neutral, PublicKeyToken=7c307b91aa13d208

7c307b91aa13d208 simple_smile

dazedorconfused avatar
Posts: 89
Joined: 06-Apr-2006
# Posted on: 10-Sep-2009 12:36:33   

Ok, thanks. So here's what I added to the LLBLGenPro.exe.config file...


<dependentAssembly>
  <assemblyIdentity name="IBM.Data.DB2" publicKeyToken="7c307b91aa13d208" culture="neutral"/>
  <bindingRedirect oldVersion="8.0.0.0-9.0.0.0" newVersion="8.1.2.1"/>
</dependentAssembly>

And per the thread you recomended yesterday, I add the following to the end of the config file, just before the closing configuration tag


  <runtime>
    <assemblyBinding xlms="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="IBM.Data.DB2" publicKeyToken="7c307b91aa13d208"/>
        <bindingRedirect oldVersion="8.0.0.0-9.0.0.0" newVersion="8.1.2.1"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>

And when I try to create a new project using the db2 driver, I get an exception. I have attached a screenshot of the error.

Attachments
Filename File size Added on Approval
LLBLGenDB2Error2.GIF 27,289 10-Sep-2009 12:36.44 Approved
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39861
Joined: 17-Aug-2003
# Posted on: 10-Sep-2009 13:59:57   

Please open the IBM.Data.DB2 dll you have problems with in reflector and check the full name of the assembly. It should be IBM.Data.DB2, Version=8.1.2.1, Culture=neutral, PublicKeyToken=7c307b91aa13d208

If not, things are you installed the wrong db2 client

There are two things going on: 1) your own application (which should run if you reference the right db2 dll) and 2) creating projects in the designer.

For 1) you'd get the error when a query is created, and the stacktrace in your first post doesn't say so, it seems to suggest you referenced the assembly in your project, but it's not found in the bin folder of your application nor is it found in the GAC (place it in the bin folder)

For 2) you've to copy the driver file compiled for 8.1 into the normal Drivers\DB2 folder, overwriting the one already there. Then restart the designer and you should be able to create a project.

Frans Bouma | Lead developer LLBLGen Pro
dazedorconfused avatar
Posts: 89
Joined: 06-Apr-2006
# Posted on: 10-Sep-2009 14:17:19   

Ok, thanks Frans... I haven't tried reflector, but I shall.

you've to copy the driver file compiled for 8.1 into the normal Drivers\DB2 folder, overwriting the one already there. Then restart the designer and you should be able to create a project.

I have done this to no avail. I am thinking now about uninstalling the DB2 Run-Time Client Lite as well as LLBLGen Pro and then reinstalling. Do you suggest installing one before the other?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39861
Joined: 17-Aug-2003
# Posted on: 10-Sep-2009 18:05:54   

dazedorconfused wrote:

Ok, thanks Frans... I haven't tried reflector, but I shall.

you've to copy the driver file compiled for 8.1 into the normal Drivers\DB2 folder, overwriting the one already there. Then restart the designer and you should be able to create a project.

I have done this to no avail. I am thinking now about uninstalling the DB2 Run-Time Client Lite as well as LLBLGen Pro and then reinstalling. Do you suggest installing one before the other?

No the order doesn't matter, but please verify first if you have indeed the right .NET DB2 assembly on your system, AND that it is reachable by LLBLGen Pro, i.e. that it is in the GAC (the IBM.DB2 assembly that is, not our driver). It might be the assembly isn't added to the gac, so the driver can't find it (or better, the .net assembly loader can't find it)

Frans Bouma | Lead developer LLBLGen Pro
dazedorconfused avatar
Posts: 89
Joined: 06-Apr-2006
# Posted on: 10-Sep-2009 18:39:37   

Ok, I looked at the IBM.Data.DB2.dll with reflector... results are below

// Assembly IBM.Data.DB2, Version 8.1.2.1 Location: C:\Program Files\IBM\SQLLIB\BIN\netf11\IBM.Data.DB2.dll Name: IBM.Data.DB2, Version=8.1.2.1, Culture=neutral, PublicKeyToken=7c307b91aa13d208 Type: Library

It is not in the GAC, so I will use GACUtil to add it? I certainly do not remember having to manually add to the GAC in the past. confused

dazedorconfused avatar
Posts: 89
Joined: 06-Apr-2006
# Posted on: 10-Sep-2009 18:47:53   

rage

I cannot add IBM.Data.DB2.dll to the GAC... I get an error.

Failure adding assembly to the cache: Strong name signature could not be verified. Was the assembly built delay-signed?

dazedorconfused avatar
Posts: 89
Joined: 06-Apr-2006
# Posted on: 10-Sep-2009 19:11:21   

alas, check out this link from IBM if you are interested...

http://www-01.ibm.com/support/docview.wss?uid=swg1JR32604

The reason I don't remember having to manually GAC the IBM.Data.DB2 dll in the past is because I didn't have to do it in the past.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39861
Joined: 17-Aug-2003
# Posted on: 10-Sep-2009 19:22:26   

Very odd that you can't add it to the gac. In c:\windows\Assembly (in explorer) it's not stored there?

The fusion log shows that .net at least can't find the dll... The signature seems to be the same as you specified in the config file so that's at least something (i.e. that the dll is the one you need)

Frans Bouma | Lead developer LLBLGen Pro
dazedorconfused avatar
Posts: 89
Joined: 06-Apr-2006
# Posted on: 10-Sep-2009 19:25:46   

From the link I posted above

Error description The installer for DB2 8.2 FP17a fails to register the netf11\IBM.Data.DB2.dll in the assembly cache. No visible error is thrown back to the installer, so this failure to register may not be immediately detected.

If one attempts to manually register this version of the DLL with the gacutil.exe tool, the following error is reported:

gacutil /i netf11\IBM.Data.DB2.dll

"Failure adding assembly to the cache: Strong name signature could not be verified. Was the assembly built delay-signed?"

This failure to register the dll does not occur with the netf10 version of the dll, nor does it occur with the netf11 version of the dll from the previous FP17 (vs 17a) release.

I found FixPack 18... I am downloading it now. I'll let you know how it goes.

dazedorconfused avatar
Posts: 89
Joined: 06-Apr-2006
# Posted on: 10-Sep-2009 19:49:26   

Installation of Fix Pack 18 over the 17A install successfully GAC'd the dll and I can now create a new DB2 Project in the designer.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39861
Joined: 17-Aug-2003
# Posted on: 11-Sep-2009 08:39:22   

dazedorconfused wrote:

Installation of Fix Pack 18 over the 17A install successfully GAC'd the dll and I can now create a new DB2 Project in the designer.

Glad it's finally sorted! simple_smile

Frans Bouma | Lead developer LLBLGen Pro
dazedorconfused avatar
Posts: 89
Joined: 06-Apr-2006
# Posted on: 11-Sep-2009 12:30:06   

Thanks for the help!