【问题标题】:OPOS with asp.netOPOS 与 asp.net
【发布时间】:2014-02-23 16:59:04
【问题描述】:

很抱歉,如果之前有人问过这个问题,但我无法在 Google 或 Bing 搜索中找到任何相关的 qns。

我正在构建一个带有 ASP.net 和 IIS 服务器收据打印的简单 POS 系统。我已经安装了 .net 1.12 的 OPOS 和 .net 的 epson OPOS,并且我已经将我的 ASP.net 项目作为参考。但我似乎无法通过“new PosExplorer();”以下代码。

PosExplorer posExplorer = new PosExplorer();
            DeviceInfo receiptPrinterDevice = posExplorer.GetDevice(DeviceType.PosPrinter);//posExplorer.GetDevice("PosPrinter", "ReceiptPrinter"); //May need to change this if you don't use a logicial name or use a different one.
            return (PosPrinter)posExplorer.CreateInstance(receiptPrinterDevice);

我得到的错误是

An exception of type 'System.TypeInitializationException' occurred in Microsoft.PointOfService.dll but was not handled in user code
Additional information: The type initializer for 'Microsoft.PointOfService.Management.Explorer' threw an exception.

我可以通过添加 app.config 使代码在 C# 桌面项目中工作。

我是否错过了 ASP.net 项目的任何配置或错误编码?可能有一个编码示例会很有帮助。

干杯, 克里斯·辛

【问题讨论】:

    标签: .net asp.net-mvc-4 c#-4.0 epson opos


    【解决方案1】:

    您可以尝试的事情: 1.来自http://social.msdn.microsoft.com/Forums/en-US/33e98f0d-04b2-4dd2-bbd4-8237610f0728/the-type-initializer-for-microsoftpointofservicemanagementexplorer-threw-an-exception?forum=posfordotnet

    <configuration>
      <runtime>
       <NetFx40_LegacySecurityPolicy enabled="true"/>
      </runtime>
    </configuration>
    
    1. 确保以 32 位模式运行应用程序池
    2. 确保您的应用程序的 bin 文件夹中有所有 DLL(Microsoft.PointOfService.ControlBase.dll 和 Microsoft.PointOfService.dll 可能还有其他)
    3. 如果您使用受限用户运行应用程序池,请尝试使用具有更高访问级别的用户帐户运行它

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-04-08
      • 1970-01-01
      • 1970-01-01
      • 2019-08-06
      • 2018-12-29
      • 2011-11-05
      相关资源
      最近更新 更多