我正在開發銷售點(POS)應用程序在Visual Studio 2017企業版上。目標框架是.NET框架4.5,我已經安裝了Microsoft POS用於.NET 1.12(OPOS),我能夠用得到的MSR讀卡器:.NET 4.5上的CAS策略與Microsoft.PointOfService
PosExplorer myPosExplorer = new PosExplorer();
到目前爲止,它是在直到今天運行的大早上安裝True Key Intel後,我開始了POS與此錯誤獲取MSR讀卡器時崩潰:
the type initializer for microsoft.pointofservice.management.explorer threw an exception.
System.notsupportedexception: this method explicitly uses CAS policy, which has been obsoleted by the .NET framework. In order to enable cas policy for compatibility reasons, please use the newfx40_legacysecuritypolicy configuration switch. please see http://go.microsoft.com/fwlink/?LinkID=155570 for mor information. at system.securitymanager.resolvepolicy(evidence evedence) at microsoft.pointofservice.management.explorer.scanforsoassemblies()
我從來沒有遇到這個錯誤之前,所以我就開始在網絡上搜索,我發現這個page。它基本上說OPOS不支持.NET 4.0(我不使用!!!)
我使用Git,所以我回滾到以前版本的代碼,並沒有運氣。我使用新的Visual Studio在新的Windows上運行POS,問題仍然存在。
OPOS有什麼問題?我是否缺少一些註冊表配置? 爲什麼這會一直告訴我關於CAS策略,當它放在.NET 4.0上並且我正在使用.NET 4.5時? 有沒有其他更好的方法來控制MSR閱讀器,打印機,線路顯示器等外設?