title: Calling COM from an ASP.NET 2.0 application works a few times and then times out?
body: <p>I'm calling a COM object from an ASP.NET application. </p>
  
  <p>Here is the code making the call:</p>
  
  <pre><code> var comType = Type.GetTypeFromProgID(config.ProgramId);
   var com = Activator.CreateInstance(comType);
   var regionPropertyValue = ReflectionHelpers.GetProperty(com, "Region");
   var output = comType.InvokeMember("Execute",
              BindingFlags.InvokeMethod,
              null, com, new object[] { data });
  </code></pre>
  
  <p>This call works for a few times and then eventually hang with the following error:</p>
  
  <p><code>Creating an instance of the COM component with CLSID {xxx} from the IClassFactory failed due to the following error: 8004e024.</code></p>
  
  <p>I'm not certain where to begin troubleshooting this. I've searched for the error code but am getting a mixed bag of results. </p>
  
  <p>Does the .NET code look correct? Do I need to manually close or dispose of anything making the call? </p>
  
  <p>Update:</p>
  
  <p>Adding the following line to release the object stopped the call from timing out. Previous calls weren't releasing the object which was causing additional calls to hang. </p>
  
  <pre><code>Marshal.FinalReleaseComObject(com);
  </code></pre>