2016-10-31 125 views
0

我正在使用下面的代碼連接到SAP cms服務器以從中獲取報表。爲水晶報表創建SessionMgr實例拋出錯誤

using CrystalDecisions.Enterprise; 

namespace ConsoleApplication1 
{ 
    class Program 
    { 
     static void Main(string[] args) 
     { 
      string username = "user"; 
      string password = "pwd"; 
      string server = "srv_name"; 
      string auth_type = "authType"; 
      // logon 
      SessionMgr session_mgr = new SessionMgr(); 
      EnterpriseSession boEnterpriseSession = session_mgr.Logon(username , password, server, auth_type); 

      //boInfoStore = (IInfoStore)boEnterpriseSession.getService("InfoStore"); 

      //boInfoStore = (IInfoStore)boEnterpriseSession.GetService("InfoStore"); 

      // get the serialized session 
      //string session_str = session.SerializedSession; 
      // pass the session to our custom bypass page on the CRS 

     } 
    } 

但在執行的代碼下面一行我得到下面提到的錯誤:SessionMgr session_mgr = new SessionMgr();

An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in CrystalDecisions.Enterprise.Framework.dll

Additional information: Retrieving the COM class factory for component with CLSID {6670DE06-3F39-4C5D-9238-71FF984D2654} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).

回答

0

據此間nobugz的回答
https://social.msdn.microsoft.com/Forums/vstudio/en-US/88a6ea68-f476-4231-822f-27fabe59f458/error-80040154-retreiving-com-class-factory?forum=vbgeneral
建議您檢查在HKCR \鍵CLSID爲GUID。如果它不在那裏,它可能在另一個文件夾(c:\ windows \ system32 ...)中。 另一種方法是用Regmon進行調試。
「它向您展示了您的應用程序如何使用註冊表,在您的應用程序上運行並在客戶上運行並對比兩者」。