简体   繁体   English

无法实例化通过导出的应用程序安装的COM +对象

[英]Unable to instantiate COM+ objects installed via exported application

I have a COM+ application that has been exported to an MSI using Component Services and then installed on a test server. 我有一个COM +应用程序,该应用程序已使用组件服务导出到MSI,然后安装在测试服务器上。 The web application (ASP) is unable to instantiate any of the objects it uses from the COM+ application. Web应用程序(ASP)无法从COM +应用程序实例化其使用的任何对象。

The COM+ application consists of three DLLs built in VB6. COM +应用程序由VB6中内置的三个DLL组成。 There is one DLL each for data, application and presentation layers. 每个DLL分别用于数据,应用程序和表示层。 The web application only uses objects from the presentation layer. Web应用程序仅使用表示层中的对象。 The COM+ DLLs call into a couple of .NET DLLs exposed via COM. COM + DLL调用通过COM公开的几个.NET DLL。

When the web application runs, an HTTP 500 - Internal Server Error is returned. Web应用程序运行时,将返回HTTP 500 - Internal Server Error No errors appear in the application or system log. 应用程序或系统日志中没有错误。

I've tried instantiating the objects from VBScript using WSH.CreateObject and it works only for objects in the data layer. 我尝试使用WSH.CreateObject从VBScript实例化对象,它仅适用于数据层中的对象。 When trying to create object in the application or presentation layer I get the following error: 尝试在应用程序或表示层中创建对象时,出现以下错误:

Error: Could not create object named "My.ProgId" 
Code: 800A801D
Source: WScript.CreateObject

Because it fails from VBScript, I suspect that the ASP app is fine and that it is the COM+ application that has issues. 因为它无法从VBScript失败,所以我怀疑ASP应用程序很好,而COM +应用程序有问题。

Extra Info 额外信息

If I uninstall the COM+ application and try to run my VBScript to test instantiation, I get a different error. 如果我卸载COM +应用程序并尝试运行VBScript以测试实例化,则会收到另一个错误。

Error: Could not locate automation class named "My.ProgId" 
Code: 80020009
Source: WScript.CreateObject

Since the errors are different, it seems that COM is at least finding the COM+ objects when they're installed, it's just not able to instantiate them. 由于错误是不同的,因此似乎COM至少在安装COM +对象时会找到它们,只是无法实例化它们。

I've also tried monitoring the script with ProcessMon. 我也尝试过使用ProcessMon监视脚本。 I can see WScript.exe (via COM) querying the registry for the ProgID, and then the CLSID. 我可以看到WScript.exe(通过COM)在注册表中查询ProgID,然后查询CLSID。 Eventually the path to the DLL is pulled back and then svchost.exe and dllhost.exe query the registry for the same information using the CLSID and also getting back the path to the DLL. 最终,DLL的路径被拉回,然后svchost.exe和dllhost.exe使用CLSID向注册表查询相同的信息,并且还返回到DLL的路径。 Eventually the DLL has a Load Image operation against it followed by the same for msvbvm60.dll. 最终,DLL对它进行了加载映像操作,然后对msvbvm60.dll进行了相同的操作。 I don't see anything that points to a failure accessing the COM+ DLL. 我没有看到任何指向COM + DLL访问失败的信息。

I've now tried installing the COM+ application to another Win2k3 server and a Windows XP desktop. 我现在尝试将COM +应用程序安装到另一台Win2k3服务器和Windows XP桌面上。 I'm getting the same result with being able to instantiate objects from the data layer DLL, but not from the application and presentation layer DLLs. 能够从数据层DLL(而不是应用程序和表示层DLL)实例化对象,从而获得相同的结果。 I've also tried getting an old copy of the application layer DLL and I am able to successfully instantiate objects from it. 我也尝试让应用层DLL的旧副本, 能够从中成功实例化对象。 However, when I compare the project files for the two different versions, nothing stands out as being a possible cause of this problem. 但是,当我比较两个不同版本的项目文件时,没有什么是引起此问题的可能原因。

The application layer DLL was referencing a struct defined in a .NET assembly. 应用程序层DLL引用了.NET程序集中定义的struct The error was caused by the type library containing the struct not being registered on the deployment machine. 该错误是由包含未在部署计算机上注册的struct的类型库引起的。

When building the .NET assembly in Visual Studio, it would create a type library for the assembly and register it. 在Visual Studio中构建.NET程序集时,它将为该程序集创建类型库并注册它。 When the app was deployed, the .NET assemblies were registered using regasm /codebase <assemblyname.dll> . 部署应用程序时,.net程序集使用regasm /codebase <assemblyname.dll> That would register the classes so that they could be instantiated, but it did not register any structs. 这样可以注册这些类,以便可以实例化它们,但是它没有注册任何结构。

The solution was to use regtlib.exe to register the type library on the test server. 解决方案是使用regtlib.exe在测试服务器上注册类型库。

The error messages were of no help at all when trying to discover the cause of the problem. 当试图发现问题的原因时,错误消息根本没有帮助。 Come on Microsoft!! 来吧微软!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM