Skip to main content

we have a WCF service that has reference to SourceCode.HostClientAPI.dll and SourceCode.Workflow.Client.dll. The Service is running fine in IIS 6.0 win 2003 machine. But in production we have IIS 7.0 Win 2008 box with only MS .Net framework 3.5 + 3.0+ 2.0  and nothing else.


After publishing we are not able see the wsdl while we see the following error occuring. Please help me in this regard. This is very urgent.


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

When you say "and nothing else" on the 2008 server, do you mean that here are no K2 components on the server? If there are K2 components installed on the server please verify that the SourceCode.HostClientAPI and SourceCode.Workflow.Client actually exists in the GAC (c:windowsassembly).


This could be a couple of issues:


1) I think there is a different version of this file for 64bit and 32bit installations so if you have copied over this file from a 32 bit machine to a 64 bit one it may be that you are trying to load a 32 bit assembly with a 64 bit call from IIS (this is the default with IIS7) You can either copy over a version of the assembly from a 64bit machine with K2 installed or set the compatibility mode in iis to be 32bit (you will need to google this).



2) This assembly has a dependency on the visual c++ redistributable package so for you on the 2008 server you should get Microsoft Visual C++ 2008 SP1 Redistributable Package


I hope this helps


It might happen not only because of this. I figured out it happened for my WCF project in case I added string

<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />

in my web.config inside service configuration section. As I removed it, everything works fine.


Try to reference the file from the version that was installed from the GAC_64 folder under your c:WindowsassemblyGAC_64SourceCode.Workflow.Client.
It is best to just copy this file into another folder inside your solution and direcly reference from Global Assembly Cache.


Another solution is to change your app pool (under advanced settings) to support 32 bit applications but my first suggestion is better.


Gabor


Reply