Sorry if this was asked before, but I was unable to find any related qns on this in Google or Bing search.
I'm building a simple POS system with ASP.net & IIS server receipt printing. I have installed OPOS for .net 1.12 and the epson OPOS for .net and I have included as a reference to my ASP.net project. But I seems to unable to get pass the "new PosExplorer();" of the following code.
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);
The error I got is
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.
I am able to get the code to work in a C# desktop project by adding in the app.config.
Did I missed out any config or wrong coding for my ASP.net project? Possible having a coding example will be great help.
Cheers, Chris Sim
Things you could try: 1. From 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>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.