简体   繁体   English

无法加载文件或程序集“sapnco”或其依赖项之一。 试图加载格式不正确的程序

[英]Could not load file or assembly 'sapnco' or one of its dependencies. An attempt was made to load a program with an incorrect format

I have got this error while I am using SAP .NET Connector 3.0 x64.我在使用 SAP .NET 连接器 3.0 x64 时遇到此错误。 I couldn't find any solution at stackoverflow, so I d like to share here for others who stuck at same problem like me.我在stackoverflow上找不到任何解决方案,所以我想在这里分享给像我一样遇到同样问题的其他人。

In VS 2017 I was able to resolve this by setting the Bitness to "x64" for IIS Express in the server section under the project web properties.在 VS 2017 中,我能够通过在项目 Web 属性下的服务器部分将 IIS Express 的 Bitness 设置为“x64”来解决此问题。 I imagine this is similar to making the Use64BitIISExpress Regedit change in one of the other answers.我想这类似于在其他答案之一中更改 Use64BitIISExpress Regedit 。

在此处输入图像描述

Run > Regedit运行 > 注册表编辑

HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\1X.0\WebProjects   

Change Use64BitIISExpress from 0 to 1 Restart Visual Studio and IISExpress. Use64BitIISExpress0更改为1重新启动 Visual Studio 和 IISExpress。

I had similar problem with x86我对 x86 有类似的问题

I set the Platform Target from "any" to "x86", in Project/Properties and fixed the problem.我在项目/属性中将平台目标从“任何”设置为“x86”并修复了问题。

You Can try browsing/configured your service through IIS, and set appPool .Net 4.0.您可以尝试通过 IIS 浏览/配置您的服务,并设置 appPool .Net 4.0。 I hope this solve the sapnco dll issue.我希望这能解决 sapnco dll 问题。

I had the same type of fix as the other answers, but in a slightly different spot...我有与其他答案相同类型的修复,但在一个稍微不同的地方......

I had to set the IIS App Pool to allow 32-Bit Applications:我必须将 IIS 应用程序池设置为允许 32 位应用程序:

应用程序池高级设置 32 位

I had similar problem with VS 2017 and AnyCPU project option.我对 VS 2017 和 AnyCPU 项目选项有类似的问题。

To fix the problem I disable Prefer 32-bit checkbox in project build properties.为了解决这个问题,我在项目构建属性中禁用了Prefer 32-bit复选框。

启动项目属性选项卡

I was having this error when trying to connect to SAP in x64 mode I was able to solve it by modifying the App.config file to include the useLegacyV2RuntimeActivationPolicy="true" attribute in the startup section:我在尝试以 x64 模式连接到 SAP 时遇到此错误,我可以通过修改 App.config 文件以在启动部分中包含useLegacyV2RuntimeActivationPolicy="true"属性来解决它:

  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
  </startup>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法加载文件或程序集xxx或其依赖项之一。 试图加载格式错误的程序。 - Could not load file or assembly xxx or one of its dependencies. An attempt was made to load a program with an incorrect format. 无法加载文件或程序集“xxx”或其依赖项之一。 试图加载格式不正确的程序 - Could not load file or assembly 'xxx' or one of its dependencies. An attempt was made to load a program with an incorrect format 无法加载文件或程序集“SharpSvn”或其依赖项之一。 尝试加载格式不正确的程序 - Could not load file or assembly 'SharpSvn' or one of its dependencies. An attempt was made to load a program with an incorrect format 无法加载文件或程序集“ MyLibrary”或其依赖项之一。 试图加载格式错误的程序 - Could not load file or assembly 'MyLibrary' or one of its dependencies. An attempt was made to load a program with an incorrect format BadImageFormatException 无法加载文件或程序集或其依赖项之一。 试图加载格式不正确的程序 - BadImageFormatException Could not load file or assembly or one of its dependencies. An attempt was made to load a program with an incorrect format 无法加载文件或程序集“ MWArray”或其依赖项之一。 试图加载格式错误的程序 - Could not load file or assembly 'MWArray' or one of its dependencies. An attempt was made to load a program with an incorrect format 无法加载文件或程序集“...”或其依赖项之一。 试图加载格式不正确的程序 - Could not load file or assembly '...' or one of its dependencies. An attempt was made to load a program with an incorrect format 无法加载文件或程序集“ Oracle.DataAccess”或其依赖项之一。 试图加载格式错误的程序。 缓存 - Could not load file or assembly 'Oracle.DataAccess' or one of its dependencies. An attempt was made to load a program with an incorrect format. Ncache 无法加载文件或程序集“ myApp.Web”或其依赖项之一。 试图加载格式错误的程序 - Could not load file or assembly 'myApp.Web' or one of its dependencies. An attempt was made to load a program with an incorrect format 无法加载文件或程序集“Skybound.Gecko”或其依赖项之一。 尝试加载格式不正确的程序 - Could not load file or assembly 'Skybound.Gecko' or one of its dependencies. An attempt was made to load a program with an incorrect format
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM