当我试图连接到Quickbook时,我得到了错误-2147220472。应用程序由windows服务执行。日志文件如下:
I 8788 RequestProcessor ========= Started Connection =========
I 8788 RequestProcessor Request Processor, QBXMLRP2 v12.0
I 8788 RequestProcessor Connection opened by app named 'QBWatcher'
I 8788 RequestProcessor OS: Microsoft Professional (build 9200), 64-bit
I 8788 RequestProcessor Current Process is elevated
I 8788 RequestProcessor Current User is in AdminGroup
I 8788 RequestProcessor Current Process is ran as Admin
I 8788 RequestProcessor Current Process Integrity Level : 3000
I 8788 RequestProcessor Previous instance of QB is going down..! Wait and retry to get a new instance.
I 8788 RequestProcessor Previous instance of QB is going down..! Wait and retry to get a new instance.
I 8788 RequestProcessor Previous instance of QB is going down..! Wait and retry to get a new instance.
I 8788 RequestProcessor Previous instance of QB is going down..! Wait and retry to get a new instance.
I 8788 RequestProcessor Previous instance of QB is going down..! Wait and retry to get a new instance.
E 8788 RequestProcessor Could not find or create an instance of QuickBooks using InstanceFinder
I 8788 RequestProcessor Connection closed by app named 'QBWatcher'
I 8788 RequestProcessor ========== Ended Connection ==========
I 8788 CertVerifier The file does not contain an Authenticode signature.这有时确实有效,但我看不出一个模式。是什么导致了这一切?
简而言之,用于连接的代码如下:
qbxmlConn.OpenConnection2(filename, "QBWatcher", QBXMLRP2Lib.QBXMLRPConnectionType.localQBD);
QBXMLRP2Lib.IAuthPreferences qbAuthPrefs = qbxmlConn.AuthPreferences;
qbAuthPrefs.PutPersonalDataPref(QBXMLRP2Lib.QBXMLRPPersonalDataPrefType.pdpNotNeeded);
qbAuthPrefs.PutUnattendedModePref(QBXMLRP2Lib.QBXMLRPUnattendedModePrefType.umpOptional);
ticket = qbxmlConn.BeginSession(filename, QBXMLRP2Lib.QBFileMode.qbFileOpenDoNotCare);发布于 2014-01-03 18:48:39
这是这个问题的关键:
应用程序由windows服务执行。
由于QuickBooks的工作方式,尝试从QuickBooks服务连接到QuickBooks(例如,在后台运行的小程序,而不是带有GUI的最终用户程序)将永远无法可靠地工作。
QuickBooks使用GUI消息泵来驱动SDK --因此,如果没有可用的GUI (例如,在没有登录到机器的用户时运行的Windows服务),则SDK/API将不可用。
对坏消息很抱歉。*-/
你能让你的程序有一个简单的GUI,并且只在用户登录时才运行(如果用户需要离开计算机,可以锁定屏幕)吗?
https://stackoverflow.com/questions/20905010
复制相似问题