Wednesday, March 27, 2019

AX 2012 R3 Retail POS Error After Upgrading to CU13 or above - Strong name validation failed security exception


We have faced a scenario when on Windows 2012 Server, the application of CU13 (28-Feb-2019 Kernel), failed the launch of POS with the following detail error in Event Log.

RetailNetTracer Error: 1 : LSRetailPosis.POS.Program: LSRetailPosis.PosisException ---> System.IO.FileLoadException: Could not load file or assembly 'Microsoft.Dynamics365.Tax.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. Strong name validation failed. (Exception from HRESULT: 0x8013141A) ---> System.Security.SecurityException: Strong name validation failed. (Exception from HRESULT: 0x8013141A)
   --- End of inner exception stack trace ---
   at Microsoft.Dynamics.Retail.Pos.Tax.TaxEngine.TaxEngineServiceProxy.InitializeTaxSession(SqlConnection connection)
   at Microsoft.Dynamics.Retail.Pos.Tax.TaxEngine.TaxEngineServiceProxy..ctor(IApplication application)
   at Microsoft.Dynamics.Retail.Pos.TaxService.Tax.Initialize()
   at Microsoft.Dynamics.Retail.Pos.SystemCore.Services.Initialize()
   at Microsoft.Dynamics.Retail.Pos.SystemCore.PosApplication.Initialize()
   --- End of inner exception stack trace ---
   at Microsoft.Dynamics.Retail.Pos.SystemCore.PosApplication.Initialize()
   at LSRetailPosis.POS.Program.InitializeAndLoadPOS(String[] args, Boolean owned, SplashScreenForm splashScreenForm).
RetailNetTracerEventLog Error: 1 : LSRetailPosis.POS.Program: LSRetailPosis.PosisException ---> System.IO.FileLoadException: Could not load file or assembly 'Microsoft.Dynamics365.Tax.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. Strong name validation failed. (Exception from HRESULT: 0x8013141A) ---> System.Security.SecurityException: Strong name validation failed. (Exception from HRESULT: 0x8013141A)
   --- End of inner exception stack trace ---
   at Microsoft.Dynamics.Retail.Pos.Tax.TaxEngine.TaxEngineServiceProxy.InitializeTaxSession(SqlConnection connection)
   at Microsoft.Dynamics.Retail.Pos.Tax.TaxEngine.TaxEngineServiceProxy..ctor(IApplication application)
   at Microsoft.Dynamics.Retail.Pos.TaxService.Tax.Initialize()
   at Microsoft.Dynamics.Retail.Pos.SystemCore.Services.Initialize()
   at Microsoft.Dynamics.Retail.Pos.SystemCore.PosApplication.Initialize()
   --- End of inner exception stack trace ---
   at Microsoft.Dynamics.Retail.Pos.SystemCore.PosApplication.Initialize()
   at LSRetailPosis.POS.Program.InitializeAndLoadPOS(String[] args, Boolean owned, SplashScreenForm splashScreenForm).
RetailNetTracer Error: 1 : LSRetailPosis.POS.Program: System.IO.FileLoadException: Could not load file or assembly 'Microsoft.Dynamics365.Tax.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. Strong name validation failed. (Exception from HRESULT: 0x8013141A)
File name: 'Microsoft.Dynamics365.Tax.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' ---> System.Security.SecurityException: Strong name validation failed. (Exception from HRESULT: 0x8013141A)
The Zone of the assembly that failed was:
MyComputer
   at Microsoft.Dynamics.Retail.Pos.Tax.TaxEngine.TaxEngineServiceProxy.InitializeTaxSession(SqlConnection connection)
   at Microsoft.Dynamics.Retail.Pos.Tax.TaxEngine.TaxEngineServiceProxy..ctor(IApplication application)
   at Microsoft.Dynamics.Retail.Pos.TaxService.Tax.Initialize()
   at Microsoft.Dynamics.Retail.Pos.SystemCore.Services.Initialize()
   at Microsoft.Dynamics.Retail.Pos.SystemCore.PosApplication.Initialize()

.
RetailNetTracerEventLog Error: 1 : LSRetailPosis.POS.Program: System.IO.FileLoadException: Could not load file or assembly 'Microsoft.Dynamics365.Tax.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. Strong name validation failed. (Exception from HRESULT: 0x8013141A)
File name: 'Microsoft.Dynamics365.Tax.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' ---> System.Security.SecurityException: Strong name validation failed. (Exception from HRESULT: 0x8013141A)
The Zone of the assembly that failed was:
MyComputer
   at Microsoft.Dynamics.Retail.Pos.Tax.TaxEngine.TaxEngineServiceProxy.InitializeTaxSession(SqlConnection connection)
   at Microsoft.Dynamics.Retail.Pos.Tax.TaxEngine.TaxEngineServiceProxy..ctor(IApplication application)
   at Microsoft.Dynamics.Retail.Pos.TaxService.Tax.Initialize()
   at Microsoft.Dynamics.Retail.Pos.SystemCore.Services.Initialize()
   at Microsoft.Dynamics.Retail.Pos.SystemCore.PosApplication.Initialize()

.
RetailNetTracer Error: 1 : LSRetailPosis.POS.Program: System.Security.SecurityException: Strong name validation failed. (Exception from HRESULT: 0x8013141A)
The Zone of the assembly that failed was:
MyComputer.
RetailNetTracerEventLog Error: 1 : LSRetailPosis.POS.Program: System.Security.SecurityException: Strong name validation failed. (Exception from HRESULT: 0x8013141A)
The Zone of the assembly that failed was:
MyComputer.


The above error was actually a security Strong name exception. A work around for this can be following commands to add entry into registry:

reg DELETE "HKLM\Software\Microsoft\StrongName\Verification" /f
reg ADD "HKLM\Software\Microsoft\StrongName\Verification\*,*" /f
reg DELETE "HKLM\Software\Wow6432Node\Microsoft\StrongName\Verification" /f
reg ADD "HKLM\Software\Wow6432Node\Microsoft\StrongName\Verification\*,*" /f