简体   繁体   English

使用Microsoft.PointOfService的.NET 4.5上的CAS策略

[英]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.

相关问题 无法在ActiveX控件中初始化Microsoft.PointOfService - cannot initailaize Microsoft.PointOfService in activex control 添加Microsoft.PointOfService命名空间后找不到命名空间“PosExplorer”的类型 - The type of namespace 'PosExplorer' not found after adding Microsoft.PointOfService namespace .net本地程序集加载因CAS策略而失败 - .net local assembly load failed with CAS policy ASP.NET Web应用程序中的CAS策略错误 - CAS Policy error in ASP.NET web Application 如果NetFx40_LegacySecurityPolicy为true,则Microsoft Pointofservice无法初始化 - Microsoft Pointofservice fails to initialize if NetFx40_LegacySecurityPolicy is true Microsoft.PointOfService.PosPrinter-方法printbitmap抛出异常 - Microsoft.PointOfService.PosPrinter - Method printbitmap threw an Exception 升级.NET 4.5后如何删除Microsoft Async Targeting Pack - How to remove Microsoft Async Targeting Pack after upgrading .NET 4.5 Microsoft.Windows.Shell命名空间等效于.Net 4.5 - Microsoft.Windows.Shell Namespace equivalent in .Net 4.5 Microsoft.PointOfService.Management.Explorer的类型初始值设定项在C#中为现金抽屉引发了异常 - type initializer for 'Microsoft.PointOfService.Management.Explorer' threw an exception in c# for cash drawer “ Microsoft.PointOfService.Management.Explorer”的类型初始值设定项引发了异常。 C#打印POS - The type initializer for 'Microsoft.PointOfService.Management.Explorer' threw an exception. C# printing POS
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM