I write a WCF Service Library hosted under an IIS website to server requests from other websites. The service has a method named Encode, is to perform encoding video files that are uploaded by end-users. I use the following assemblies:
Microsoft.Expression.Encoder.Api2.dll, Microsoft.Expression.Encoder.dll, Microsoft.Expression.Encoder.Types.dll, Microsoft.Expression.Encoder.Utilities.dll,
I have tested the encode function directly from console application. However, when I test via IIS website, the error bellow always throws whenever I call the encode method.
{"Could not load file or assembly 'Microsoft.Expression.Encoder, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. An attempt was made to load a program with an incorrect format."}
I checked whether those Dlls are in Assembly folder, and they are not, so I copied them to GAC, and they are in GAC32. I had to do so because when I published WCF to IIS website, it copied those Dlls to bin folder and I could not add service reference. I could only add service reference when I delete those Dlls from bin folder. Copy those Dlls to GAC.
I also read some articles that indicate there is a conflict between the DLL platform and running application's platform. That means that DLL is built with 32-bit application, but the running application is running under 64-bit application, etc. I then tried to set the platform and framework to 32 and 4.0 accordingly, but the running application will throw the errors when I add service reference.
I'm confused and do not know where is the root of the problem and how to resolve it.