使用32位COM连接强制关闭错误组件调用

问题描述:

我在调用类库方法的Microsoft Visual Studio 2008中有一个.asmx Web服务。类库方法正在调用通过32位机器构建的第三方COM组件。使用32位COM连接强制关闭错误组件调用

我的网站服务器是64位Windows Server 2012 R2标准版。我通过此服务器上的IIS版本8.5部署了此Web服务。

当我第一次访问该Web服务,我被抛出如下COM异常:

Exception: System.Runtime.InteropServices.COMException Message: Retrieving the COM class factory for component with CLSID {some GUID} failed due to the following error: 80040154.

由于这个错误的决定,我做在IIS应用程序池设置了一些变化。我去了IIS中相关应用程序池的高级设置,并将“启用32位应用程序”属性设置为false。 然后我重新启动了应用程序池和IIS。

当我再次访问Web服务低谷调试单元测试,这一次我没有上面的错误遇到,但调试程序崩溃并在单元测试抛出一个错误信息如下:

Test method ABC threw exception: System.ServiceModel.CommunicationException: > An error occurred while receiving the HTTP response to http://localhost/MyService/MyServices.asmx . This could be due to the service > endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service > shutting down). See server logs for more details. --->
System.Net.WebException: The underlying connection was closed: An unexpected > error occurred on a receive. ---> System.IO.IOException: Unable to read data > from the transport connection: An existing connection was forcibly closed by > the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host.

我还注意到了管理事件日志。我可以在随机时间看到一个错误:

A process serving application pool 'DefaultAppPool' suffered a fatal communication error with the Windows Process Activation Service. The process > id was '3580'. The data field contains the error number.

请帮我解决这个问题。

在此先感谢。

一些事情。幽州:

which is build over a 32 bit machine.

and Set Enable 32 Bit Applications property to false.

更改,设置回True。你的COM DLL很可能是一个32位的二进制文件。您将无法将32位二进制文​​件加载到64位进程中。

其次错误代码80040154意味着您的COM库尚未注册。为此,打开命令行窗口(您需要在“运行方式管理员联系”):

%SYSTEMROOT%\SysWOW64\regsvr32.exe <path_to_DLL> 

例如:

%SYSTEMROOT%\SysWOW64\regsvr32.exe "c:\program files (x86)\MyApp\MyLib.dll" 
+0

仍然没有运气。我已启用32位应用程序并将其设置为true。我也通过regsvr32注册了它。我仍然遇到异常。测试方法ABC引发异常:System.ServiceModel.CommunicationException:>接收到http://localhost/MyService/MyServices.asmx的HTTP响应时发生错误。这可能是由于服务>端点绑定不使用HTTP协议。这也可能是由于HTTP请求上下文被服务器中止(可能由于服务>关闭)。查看服务器日志获取更多详细信---> –

+0

@SachinPuri - 没有看到你的代码,配置等我真的帮不了太多。 – Kev

+0

我可以为您提供任何细节。你需要 –