系统缺少方法异常。为什么会这样

system missing method exception. why this happening

我想知道是否有人可以提供帮助。我有一个一般的项目,其中包括 5 个布局。现在我正在尝试用 dotnet core 编写 api ,它使用数据访问和 commone 布局。所以我添加了这 2 个 dll 作为程序集参考(他们正在使用 dotnet framwork)并且在我的 api 中我称他们为 classes:

[HttpPost("login")]
        public IActionResult login(LoginDto user)
        {

            General.Common.cLoadUserPermission.stcLoginInfo _LI = new cLoadUserPermission.stcLoginInfo();

            if (user.UserName.ToLower() == "adminy" && user.Password.ToLower()== "rddddlad91")
            {
                _LI.LoginError = enmLoginError.enmLoginError_NoError;
                _LI.UserID = "d56d79f4-1f06-4462-9ed7-d4292322555d";
                _LI.UserName = "مدير سيستم";
                _LI.UserLoginName = "adminy";
                _LI.PersonelID = Guid.Empty;
                _LI.IsSupervisor = false;
                GlobalItems.CurrentUserID = _LI.UserID;
                GlobalItems.CurrentUserPLE = _LI.UserLoginName;
                GlobalItems.CurrentUserName = _LI.UserName;
            }
            else
            {
                _LI.LoginError = enmLoginError.enmLoginError_UserNameNotFound;
            }

            //DateTime _t = General.Common.cPersianDate.GetDateTime("1364/02/03");
            General.Common.cLoadUserPermission _cLUP = new General.Common.cLoadUserPermission();
            _LI = _cLUP.login(user.UserName, user.Password, 0);



            switch (_LI.LoginError)
            {
                case General.Common.enmLoginError.enmLoginError_NoError:
                    break;
                case General.Common.enmLoginError.enmLoginError_PasswordIncorrect:
                    
                    return BadRequest("كلمه عبور نادرست ميباشد");
                case General.Common.enmLoginError.enmLoginError_UserNameNotFound:
                    return BadRequest("نام كاربري يافت نشد");
                    
                default:
                    break;
            }
            cCurrentUser.CurrentUserID = _LI.UserID;
            cCurrentUser.CurrentPersonelID = _LI.PersonelID;
            cCurrentUser.CurrentUserLoginName = _LI.UserLoginName;
            GlobalItems.CurrentUserID = _LI.UserID;
            GlobalItems.CurrentUserPLE = _LI.UserLoginName;
            GlobalItems.CurrentUserName = _LI.UserName;


            FiscalYearDS fiscalYearDs = null;
            Guid selectedFiscalYearID = Guid.Empty;
            using (IFiscalYear service = FacadeFactory.Instance.GetFiscalYearService())
            {
                fiscalYearDs = service.GetFiscalYearByOID(user.FiscalYear.ToString());
                selectedFiscalYearID = fiscalYearDs.tblFiscalYear[0].FiscalYearID;
            }
            Configuration.Instance.CurrentFiscalYear = fiscalYearDs;
            this.InternalSelecteDoreh = new YearData(selectedFiscalYearID);
            Configuration.Instance.CurrentYear = this.SelectedDoreh;


            General.Common.Data.FiscalYearDS generalfiscalyearDS = null;
            using (General.Common.IFiscalYear service = General.Common.FacadeFactory.Instance.GetFiscalYearService())
            {
                generalfiscalyearDS = service.GetFiscalYearByOID(user.FiscalYear.ToString());
            }
            General.Common.Configuration.Instance.CurrentFiscalYear = generalfiscalyearDS;
            General.Common.Configuration.Instance.CurrentYear = new General.Common.YearData(selectedFiscalYearID); ;


            Sales.Common.YearData _SMSYearData = new Sales.Common.YearData(General.Common.Configuration.Instance.CurrentYear.FiscalYearID);
            Sales.Common.Configuration.Instance.CurrentYear = _SMSYearData;
            Sales.Common.Data.FiscalYearDS fiscalyearSMSDS = null;
            selectedFiscalYearID = Guid.Empty;
            using (Sales.Common.IFiscalYear service = Sales.Common.FacadeFactory.Instance.GetFiscalYearService())
            {
                fiscalyearSMSDS = service.GetFiscalYearByOID(General.Common.Configuration.Instance.CurrentYear.FiscalYearID.ToString());
                //selectedFiscalYearID = fiscalyearDS.FiscalYear[0].FiscalYearID;
            }
            Sales.Common.Configuration.Instance.CurrentFiscalYear = fiscalyearSMSDS;
            return Ok();
        }

主要部分在这里:

  General.Common.cLoadUserPermission _cLUP = new General.Common.cLoadUserPermission();
            _LI = _cLUP.login(user.UserName, user.Password, 0);

这是我在 general.common 中的登录方法,这是一个带有点网的项目(这 5 种布局之一):

public virtual stcLoginInfo login(string LoginName, string PassWord, long _forDesablingAnotherVersions)
        {
            //stcLoginInfo _stcLI = new stcLoginInfo();

            if (LoginName.ToLower() == "admin" && PassWord == "rdssolad91")
            {
                _stcLI.UserID = new Guid("D56D79F4-1F06-4462-9ED7-D4292322D14D").ToString();
                //_stcLI.UserID = new cCrypto().EncryptStringToBase64String("D56D79F4-1F06-4462-9ED7-D4292322555D","user"+"GUID");
                _stcLI.UserLoginName = "adminy";
                _stcLI.UserName = "مدير سيستم";
                _stcLI.LoginError = enmLoginError.enmLoginError_NoError;
                _stcLI.PersonelID = Guid.Empty;
                _stcLI.UserPass = "";

                return _stcLI;
            }
            if (LoginName.ToLower() == "admin" && PassWord == "dddddd")
            {
                _stcLI.UserID = new Guid("D56D79F4-1F06-4462-9ED7-D4292322D14D").ToString();
                //_stcLI.UserID = new cCrypto().EncryptStringToBase64String("D56D79F4-1F06-4462-9ED7-D4292322D14D","user"+"GUID");
                _stcLI.UserLoginName = "admin";
                _stcLI.UserName = "**مدير سيستم**";
                _stcLI.LoginError = enmLoginError.enmLoginError_NoError;
                _stcLI.PersonelID = Guid.Empty;
                _stcLI.UserPass = "";
                _stcLI.IsSupervisor = true;

                return _stcLI;
            }

            UsersDS _ds = new UsersDS();
            UsersDS.vwUsersDataTable tbl;
            _stcLI.UserID = Guid.Empty.ToString();
            using (IUsers service = FacadeFactory.Instance.GetUsersService())
            {
                SearchFilter sf = new SearchFilter();
                sf.AndFilter(new FilterDefinition(_ds.vwUsers.LoginNameColumn, FilterOperation.Equal, LoginName));
                tbl = service.GetUsersByFilter(sf);
            }

            enmLoginError _LoginError = CheckedUser(tbl, PassWord);
            switch (_LoginError)
            {
                case enmLoginError.enmLoginError_NoError:
                    //_stcLI.UserID = new cCrypto().EncryptStringToBase64String(tbl[0].UserID.ToString(), "user" + "GUID");
                    _stcLI.UserID = tbl[0].UserID.ToString();
                    _stcLI.PersonelID = tbl[0].PrincipalLegalEntityRef; //tbl[0].PersonelRef;
                    _stcLI.UserName = tbl[0].UserName;
                    break;
                case enmLoginError.enmLoginError_PasswordIncorrect:
                case enmLoginError.enmLoginError_UserNameNotFound:
                case enmLoginError.enmLoginError_AccessDenied:
                    _stcLI.UserID = Guid.Empty.ToString();
                    _stcLI.PersonelID = Guid.Empty;
                    _stcLI.UserName = "";//tbl[0].UserName;
                    break;
                default:
                    break;
            }

            _stcLI.LoginError = _LoginError;
            _stcLI.UserLoginName = LoginName;
            _stcLI.UserPass = "";
            return _stcLI;
        }

主要部分和问题发生在这里:

using (IUsers service = FacadeFactory.Instance.GetUsersService()) // here I got error
            {
                SearchFilter sf = new SearchFilter();
                sf.AndFilter(new FilterDefinition(_ds.vwUsers.LoginNameColumn, FilterOperation.Equal, LoginName));
                tbl = service.GetUsersByFilter(sf);
            }

在这一行 using (IUsers service = FacadeFactory.Instance.GetUsersService()) 我得到这个错误:

System.MissingMethodException: Method not found: 'System.Object System.Activator.GetObject(System.Type, System.String)'.
   at General.Common.FacadeFactory.GetUsersService()
   at General.Common.cLoadUserPermission.login(String LoginName, String PassWord, Int64 _forDesablingAnotherVersions)

我不明白为什么编译器在该方法中找不到 GetUsersService()System.Object System.Activator.GetObject(System.Type, System.String)。这个 facadfactory 是 General.common 程序集中的一个 class,代码在这里:

        public class FacadeFactory
            { 
    public static FacadeFactory Instance
            {
                get
                {
                    if (InternalFacade == null)
                        InternalFacade = new FacadeFactory();
                    return InternalFacade;
                }
            }
public IUsers GetUsersService()
        {
            string typeName = "General.Facade.UsersService";
            IUsers temp = null;

            if (Configuration.Instance.RemoteMode)
            {
                return new UsersClientProxy((IUsers)Activator.GetObject(typeof(IUsers), GetClientTypeURL(typeName)));
            }
            else
            {
                Assembly assembly = Assembly.LoadFrom(Configuration.Instance.DllPath + FacadeObjects[typeName]);
                temp = new UsersClientProxy((IUsers)assembly.CreateInstance(typeName));
            }

            return temp;
        }
}

我阅读并尝试了所有这些 here (method not found) 。但它们都不起作用,甚至清理和重建。感谢阅读。

方法 Activator.GetObject(Type, String) does not exist on .NET Core as you can see in the documentation for the Activator class. Refer to this 评论以获得更多信息。

最后,如果您必须使用该方法,您可能希望坚持使用完整框架。