2017-05-31 37 views
0

我正在开发销售点(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阅读器,打印机,线路显示器等外设?

回答

1

如果可以,我建议您更新到.NET 1.14.1的POS并更新您的服务对象。

这就是说,因为你正在使用.NET 4.5,你在同一条船上的文章您链接关于.NET 4.0

你应该能够在add the legacy CAS switch为它的app.config文件上班。请确保以下代码块位于您的app.config中。请注意,配置文件中可能已有configuration元素,因此您只需要添加runtime部分即可。

<configuration> 
    <runtime> 
     <NetFx40_LegacySecurityPolicy enabled="true"/> 
    </runtime> 
</configuration>