gpt4 book ai didi

.net - ACCPAC 缺少方法异常

转载 作者:行者123 更新时间:2023-12-04 16:02:07 30 4
gpt4 key购买 nike

我有一个在完整的 .NET 4.6.2 上运行的 ASP.NET Core 1.1 网络服务器。我正在使用 ACCPAC.Advantage.dll(打包在自定义 NuGet 包中)连接到本地 Sage 安装。之前连接已成功启动,我能够将批处理过帐到应付帐款。但是现在启动连接失败并出现以下错误:

System.MissingMethodException: Method not found: 'ACCPAC.Advantage.DBLink ACCPAC.Advantage.Session.OpenDBLink(ACCPAC.Advantage.DBLinkType, ACCPAC.Advantage.DBLinkFlags)'.

Intellisense 和 ReSharper 的反编译功能可以轻松找到 Session.OpenDBLink 方法,那么为什么在运行时找不到它?

它会不会从全局程序集缓存中提取了错误的程序集?在不破坏需要这些程序集的其他应用程序的情况下解决该问题的最佳方法是什么?

最佳答案

另一位 Sage 第三方开发人员提出了一个 .Net 问题,这听起来像您遇到的问题。这是他们在 Sage City 论坛 ( Sage City Post ) 上不得不说的话:

In Sage 2018 PU2 Sage have decided to....

Bump the version number of \HKLM\SOFTWARE\WOW6432Node\ACCPAC International, Inc.\ACCPAC\Web\A4WNET to 6.5.0.2 but not keep this in step with the .net runtime library version (6.5.0.10). This has broken 8 versions of Sage300 where the two have been in step.

Why is this a problem? The .net assemblies are loaded into the GAC and to avoid having to recompile/re-release your application after version update we use reflection to load the assemblies.

Prior to this update we could use System.Reflection.Assembly.Load([full assembly signature]). However, to use this method we need to know the version of the S300 runtime assembly (Accpac.Advantage.dll), which we obtained by querying the registry.

To work around the issue we now use the System.Reflection.Assembly.LoadFile method. This is fine, but it does bypass the checks the .net assembly loader does when calling Load.

const string SAGE_RUNTIME = "Sage\\Sage 300 ERP\\ACCPAC.Advantage.dll";

Assembly assem =
Assembly.LoadFile(
System.IO.Path.Combine(
Environment.GetFolderPath(
Environment.SpecialFolder.CommonProgramFilesX86), SAGE_RUNTIME));

编辑:另一种选择是通过 .Net 使用 COMApi 接口(interface)。

关于.net - ACCPAC 缺少方法异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50164057/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com