Connection Forcibly Closed Error with 32 bit COM Component call
<p>I have a .asmx web service in Microsoft Visual Studio 2008  which is calling a class library method. The class library method is making a call to a third party COM compoment which is build over a 32 bit machine.</p>

<p>My web server is a 64-bit Windows Server 2012 R2 Standard edition. I have deployed this web service over IIS version 8.5 on this server.</p>

<p>When I first accessed this web service, I was thrown a COM Exception as below:</p>

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

<p>As a resolution of this error, I made some changes in Application Pool settings in IIS. I went to Advanced settings of the related Application Pool in IIS and Set Enable 32 Bit Applications property to false.
Then I restarted the application pool and IIS.</p>

<p>Again when I accessed the web service trough debugging a Unit test, this time I didn't encounter above error, but the debugger gets crashed and thrown a error message in unit test as follows:</p>

<blockquote>
  <p>Test method ABC threw exception:  System.ServiceModel.CommunicationException: > An error occurred while receiving the HTTP response to
  <a href="http://localhost/MyService/MyServices.asmx" rel="nofollow">http://localhost/MyService/MyServices.asmx</a>. 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. ---><br>
  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.</p>
</blockquote>

<p>I also noticed the Administrative Events Log. and I could see one error at random times:</p>

<blockquote>
  <p>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.</p>
</blockquote>

<p>Please help me out to fix this issue.</p>

<p>Thanks in advance.</p>