Support
Joined: 18 Jul 2005 Posts: 731
|
Posted: Sat Jun 06, 2009 5:58 am Post subject: HOWTO: Trouble-shoot the license service using LicenseService.LogException |
|
|
If you find that the license service is not working on a web server where it is not possible to debug, you can use the LicenseService.LogException method to find out the potential cause of the failure.
To do this, in the LicenseService.cs (or LicenseService.vb) file in the App_Code directory, override the appropriate method (for example, if activation is not working, override the OnActivate method, call the base class method from it and enclose this call with a try-catch and call LicenseService.LogException in the catch block as follows:
[C#]
Code: | protected override string OnActivate(CryptoLicense license, string machineCodeString)
{
try
{
return base.OnActivate(license, machineCodeString);// simply call base class method
}
catch (System.Exception e)
{
LicenseService.LogException(e); // log exception
}
return null;
} |
[VB.NET]
Code: | Protected Overrides Function OnActivate(ByVal license As LogicNP.CryptoLicensing.CryptoLicense, ByVal machineCodeString As String) As String
Try
Return MyBase.OnActivate(license, machineCodeString) ' simply call base class method
Catch ex As Exception
LicenseService.LogException(ex) ' log exception
End Try
Return Nothing
End Function |
The LicenseService.LogException method will log all information about the exception including its stack trace in the 'log.txt' file in the App_Data directory. |
|