无法加载文件或程序集“Microsoft.Expression.Encoder" [英] Could not load file or assembly 'Microsoft.Expression.Encoder'

查看:36
本文介绍了无法加载文件或程序集“Microsoft.Expression.Encoder"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编写了一个 WCF 服务库,托管在 IIS 网站 下,用于服务器来自其他网站的请求.该服务有一个名为Encode的方法,用于对最终用户上传的视频文件进行编码.我使用以下程序集:

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,

Microsoft.Expression.Encoder.Api2.dll, Microsoft.Expression.Encoder.dll, Microsoft.Expression.Encoder.Types.dll, Microsoft.Expression.Encoder.Utilities.dll,

我已经直接从控制台应用程序测试了编码功能.但是,当我通过 IIS 网站进行测试时,每当我调用 encode 方法时,总是会抛出以下错误.

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."}

我检查了那些 Dll 是否在 Assembly 文件夹中,它们不在,所以我将它们复制到 GAC,它们在 GAC32 中>.我必须这样做,因为当我将 WCF 发布到 IIS 网站 时,它会将这些 Dll 复制到 bin 文件夹,而我无法添加服务引用.当我从 bin 文件夹中删除这些 Dll 时,我只能添加服务引用.将这些 Dll 复制到 GAC.

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.

我还阅读了一些文章,指出 DLL 平台和运行应用程序的平台之间存在冲突.这意味着DLL是用32位应用程序构建的,但是正在运行的应用程序是在64位应用程序下运行的,等等.然后我尝试将平台和框架相应地设置为32和4.0,但是运行的应用程序会在运行时抛出错误我添加了服务引用.

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.

更新:这是我的应用程序池:

Update: This is my application pool:

推荐答案

尝试加载格式不正确的程序",这部分给了你关键,当你尝试使用 x64 程序集时会发生这种情况在 32 位进程中,因此,您的 IIS 设置为 32 位(默认情况下是这样),使用 32 位 dll 或更改您的 IIS 配置以在 64 位模式下运行

"An attempt was made to load a program with an incorrect format", this part is giving you the key, this happens when you try to use an x64 assembly in a 32 bit process, thus, your IIS is set up as 32 bits (is as it comes by default), use the 32 bit dll's or change your IIS config to run in 64 bit mode

这篇关于无法加载文件或程序集“Microsoft.Expression.Encoder"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆