很抱歉,如果这是之前的问题,但我没有找到任何相关的qns在谷歌或必应搜索。
我正在构建一个简单的POS系统,使用ASP.net & IIS收据打印。我已经为.net 1.12安装了OPOS,为.net安装了epson OPOS,我还包括了对我的ASP.net项目的参考。但是,我似乎无法传递以下代码的“();”。
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.我可以通过添加C#桌面项目使代码在app.config中工作。
我是否遗漏了ASP.net项目的任何配置或错误的编码?可能有一个编码例子将是很大的帮助。
干杯,克里斯·辛
发布于 2014-02-10 15:15:18
你可以尝试的东西: 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>https://stackoverflow.com/questions/21472615
复制相似问题