简体   繁体   中英

OPOS with asp.net

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>
  1. Ensure you run your application pool in 32 bit mode
  2. Ensure you have all DLLs (Microsoft.PointOfService.ControlBase.dll and Microsoft.PointOfService.dll and maybe others) in your application's bin folder
  3. If you're running your application pool with a restricted user, try running it with a user account with a higher access level

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM