Question

Could not load file or assembly 'SourceCode.HostClientAPI' - Custom application on new server

  • 11 February 2015
  • 6 replies
  • 66 views

We are hosting a custom application on a new Windows 2012R2 IIS server.  The K2 assemblies have been included with the deployed project but nothing else has been installed on the new dev server (aside from .Net and the 2008 C++ Redistributable Package).  32-bit applications have been enabled for this particular application pool.

 

(Searching this forum has resulted in a similar thread but I didn't find a solid resolution.)

 

Any assistance is appreciated!  When we browse to the application we get the following error: 

 

Could not load file or assembly 'SourceCode.HostClientAPI' or one of its dependencies. An attempt was made to load a program with an incorrect format. 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.BadImageFormatException: Could not load file or assembly 'SourceCode.HostClientAPI' or one of its dependencies. An attempt was made to load a program with an incorrect format.

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 'SourceCode.HostClientAPI' could not be loaded.

=== Pre-bind state information ===
LOG: DisplayName = SourceCode.HostClientAPI
(Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: SourceCode.HostClientAPI | Domain ID: 25
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:///D:/inetpub/wwwroot/CIM-FORMS/
LOG: Initial PrivatePath = D:inetpubwwwrootCIM-FORMSin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: D:inetpubwwwrootCIM-FORMSweb.config
LOG: Using host configuration file: C:WindowsMicrosoft.NETFrameworkv4.0.30319aspnet.config
LOG: Using machine configuration file from C:WindowsMicrosoft.NETFrameworkv4.0.30319configmachine.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/v4.0.30319/Temporary ASP.NET Files/root/74bfa72a/2c322f7d/SourceCode.HostClientAPI.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/74bfa72a/2c322f7d/SourceCode.HostClientAPI/SourceCode.HostClientAPI.DLL.
LOG: Attempting download of new URL file:///D:/inetpub/wwwroot/CIM-FORMS/bin/SourceCode.HostClientAPI.DLL.
ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.

6 replies

Userlevel 4
Badge +3

Couple things to try as I'm 100% sure of the resolution:

  • Make sure the dll is unblocked in its properties
  • Add to the GAC
  • Use the 64 bit version of the dll (on my system which is the k2 server it includes the 64 bit version in the hostserver folder.

or is it the case that its already 64 bit dll and you have other 32 bit dlls that required the 32 bit compatability.  However, from the following article setting the app pool setting will cause it to only load 32 bit apps.

 

https://technet.microsoft.com/en-us/library/cc745955.aspx

Enable 32-bit Applications

[enable32BitAppOnWin64]
If set to True for an application pool on a 64-bit operating system, the worker process(es) serving the application pool run in WOW64 (Windows on Windows64) mode. In WOW64 mode, 32-bit processes load only 32-bit applications.

timkm,

  I truly appreciate your responses.  We are a new to K2 so I've got a few (perhaps overly obvious) questions

 

  • which dll?
  • can you point me to some guidelines on how to add to the GAC?  and what am I adding?
  • does the 64 bit dll need to be included with the project via Visual Studio?  Or installed somewhere on the server?
  • are you recommending I set the Enable 32 bit applications back to FALSE?

Thanks again

Blake

Your reply was very helpful, it looks like it was a difference between the 32/64 bit DLLs (why it worked on our developer machine vs our DEV server)

 

Where can we get a copy of the 64bit DLLs?

 

Thanks again

Blake

Userlevel 4
Badge +3

On my dev VM I use a tool called InspectEXE.  It lists the SourceCode.HostClientAPI and the SourceCode.Workflow.Client.dll as being 64 bit in the K2 blackpearlHost Serverin folder. 

 

I noted that the SourceCode.Workflow.Client.dll in the K2 blackpearlin folder is 32 bit.

 

Regards,

Tim

Thanks very much - we'll try that!

Hallo All,

 

I get some case here, my application always show error:

 

Could not load file or assembly 'SourceCode.HostClientAPI' or one of its dependencies. An attempt was made to load a program with an incorrect format.

 

after I add referances SourceCode.HostClientAPI and the SourceCode.SmartObjects.Client (File version 4.15050.15272.4)

My dev environment is win-7 64 bit, but my k2 instaler is 32 Bit.

 

Any other advice please. 

 

Thank you,

Regards.



Reply