[英]CAS policy on .NET 4.5 with Microsoft.PointOfService
I am working on a Point Of Sale (POS) app on Visual Studio 2017 enterprise edition. 我正在使用Visual Studio 2017企业版上的销售点(POS)应用程序。 The target framework is .NET framework 4.5, I have installed Microsoft POS for .NET 1.12 (OPOS) and I was able to get the MSR card reader with:
目标框架是.NET Framework 4.5,我已经安装了用于.NET 1.12(OPOS)的Microsoft POS,并且能够通过以下方式获得MSR卡读取器:
PosExplorer myPosExplorer = new PosExplorer();
PosExplorer myPosExplorer = new PosExplorer();
So far it was running great until today in the morning after installing True Key Intel , my POS started to crash when getting the MSR reader with this error: 到目前为止,它运行良好,直到安装了True Key Intel的今天早上,当我得到此错误的MSR阅读器时,我的POS开始崩溃:
the type initializer for microsoft.pointofservice.management.explorer threw an exception.
microsoft.pointofservice.management.explorer的类型初始值设定项引发了异常。
System.notsupportedexception: this method explicitly uses CAS policy, which has been obsoleted by the .NET framework.
System.notsupportedexception:此方法显式使用CAS策略,该策略已被.NET框架淘汰。 In order to enable cas policy for compatibility reasons, please use the newfx40_legacysecuritypolicy configuration switch.
为了出于兼容性原因启用cas策略,请使用newfx40_legacysecuritypolicy配置开关。 please see http://go.microsoft.com/fwlink/?LinkID=155570 for mor information.
请参阅http://go.microsoft.com/fwlink/?LinkID=155570,以了解更多信息。 at system.securitymanager.resolvepolicy(evidence evedence) at microsoft.pointofservice.management.explorer.scanforsoassemblies()
在system.securitymanager.resolvepolicy(证据证据)处microsoft.pointofservice.management.explorer.scanforsoassemblies()
I had never faced this error before, so i started to search on the web and i found this page . 我以前从未遇到过此错误,因此我开始在网上搜索并找到此页面 。 It basically says OPOS is not supported for .NET 4.0 (Which i am not using!!!)
它基本上说.NET 4.0不支持OPOS(我未使用!!!)
I am using Git, so i rolled back to a previous version of the code and have no luck. 我使用的是Git,所以我回滚到以前的代码版本,没有运气。 I run the POS on a new Windows with a new Visual Studio and the problem stills there.
我在带有新Visual Studio的新Windows上运行POS,问题仍然存在。
What is it wrong with OPOS? OPOS有什么问题? Am i missing some registry configuration?
我是否缺少某些注册表配置? Why does this keep telling me about CAS policy when it was dropped on .NET 4.0 and I am using .NET 4.5?
为什么当在.NET 4.0上删除CAS策略并且使用.NET 4.5时,为什么一直告诉我有关CAS策略的信息? Is there any other better way to control peripherals like MSR readers, printers, line displays, etc. ?
还有其他更好的方法来控制外围设备,例如MSR阅读器,打印机,行显示器等吗?
If you can, I would suggest that you update to POS for .NET 1.14.1 and update your service objects. 如果可以,我建议您更新到POS for .NET 1.14.1并更新服务对象。
That said, since you're using .NET 4.5, you're in the same boat as the article you linked regarding .NET 4.0 就是说,由于您使用的是.NET 4.5,因此与您所链接的有关.NET 4.0的文章在同一条船上
You should be able to add the legacy CAS switch in your app.config file for it to work. 您应该能够在app.config文件中添加旧式CAS开关 ,使其正常工作。 Just ensure the following block of code is in your app.config.
只要确保以下代码块在您的app.config中即可。 Note that there is probably already a
configuration
element in the config file, so you should only need to add the runtime
section. 请注意,配置文件中可能已经有一个
configuration
元素,因此您只需要添加runtime
部分。
<configuration>
<runtime>
<NetFx40_LegacySecurityPolicy enabled="true"/>
</runtime>
</configuration>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.