Note that there are some explanatory texts on larger screens.

plurals
  1. POCreate OLE object from Windows service
    text
    copied!<p>I have Windows service that tries to create and use OLE object (namely - Matlab via automation) with this code:</p> <pre><code>var type = Type.GetTypeFromProgID("matlab.application"); var matlab = Activator.CreateInstance(type); </code></pre> <p>Everything works OK on my machine (Win7 x64, with single user), but on production server (Win 2008 R2 Datacenter SP1) I have problems. It works there if I start service as usual exe file (I have this possibility), but if I try to start it as service, it returns excepion:</p> <blockquote> <p>System.Runtime.InteropServices.COMException (0x80080005): Retrieving the COM class factory for component with CLSID {AC62BA4E-6ED9-4F33-9967-B260419E5EAD} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE)).</p> </blockquote> <p>I tried:</p> <ul> <li>start service under System/Administator/another user account</li> <li>check configuration with dcomcnfg utility (it helps actually, I had another error, but now all permissions for "matlab.automation" dcom object are granted)</li> <li>ater call of "Activator.CreateInstance" there is Matlab.exe process in memory, but it just hangs..</li> </ul> <p>So - how can I use Matlab automation object from Windows service?</p> <p>Thanks a lot!</p> <p><strong>UPDATE</strong></p> <p>Probably it will help - production server is Amazon EC2 instance, so it has also Terminal Server. Maybe this could be a problem? Because I had problem with mutexes before, and it was resolved by creating global mutex..</p> <p><strong>UPDATE 2</strong></p> <p>Exception occurs always in 120 seconds (exactly), so it looks like OLE client doesn't see call of CoRegisterClassObjects, or probably any other call. In any case - delay between call of Activator.CreateInstance and exception is exactly 120 seconds.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload