[英]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. Use64BitIISExpress
从0
更改为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 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.