Hi, I have .Net web-app that uses the XI2 SDK to export Webi Reports as HTML to the app. We impersonate as the current Active Directory user, which is also mapped as a BO user and log on using secWinAD.
The problem we are having is that a 2nd concurrent license is being taken by each user when we create the IReportEngine instance. When we log off from the session, the 1st license is correctly returned, but the 2nd one is not, meaning we have to wait for it to time out before it can be used again.
Any ideas why? Please see code below with comments describing when the concurrent licenses are taken:
            
WindowsIdentity winId = new WindowsIdentity("USERNAME@DOMAIN");
//Start impersonating.
WindowsImpersonationContext ctx = winId.Impersonate();
//Access resources using the identity of the authenticated user.
//NOTE - 1st License is taken here - CORRECT
EnterpriseSession session = (new SessionMgr()).Logon("", "", "SERVERHOSTNAME", "secWinAD");
// Revert impersonation.
ctx.Undo();
            
ReportEngines reportEngines = new ReportEngines(session.LogonTokenMgr.DefaultToken);
//NOTE - After this line, an additional license is taken - WHY?
IReportEngine boIReportEngine = reportEngines.getService(ReportEngineType.WI_ReportEngine);
IDocumentInstance document = boIReportEngine.OpenDocument(1234);
//... Do some work with the document...
document.CloseDocument();
reportEngines.Close();
session.Logoff(); //NOTE - License taken from new SessionMgr()).Logon(..) code is correctly returned here
//At this point, an orphansed license is left, meaning we lose a user until it times out.JonoWard (BOB member since 2009-03-30)