T
Trokey
I am having a serious problem connecting to out-of-process COM objects in my windows service application. Whenever I try to create an instance of the COM object, a second instance of the COM server is started up instead of attaching to the already running one. I have tried the following fixes with no results:
1. added these lines to my service:
System.Threading.Thread.CurrentThread.ApartmentState = ApartmentState.STA;
int ret = CoInitializeSecurity(IntPtr.Zero, -1, IntPtr.Zero, IntPtr.Zero, 4, 3, IntPtr.Zero, 0, IntPtr.Zero);
2. ran dcomcnfg.exe and changed Default Authentication Level to Default and Default Impersonation Level to Impersonate.
3. Changed the "Log On" settings for the service to use my account/password.
None of these change the situation - however, I still feel it may be a security issue. If I run my app NOT as a service, it works fine.
What's going on here???
Matt
1. added these lines to my service:
System.Threading.Thread.CurrentThread.ApartmentState = ApartmentState.STA;
int ret = CoInitializeSecurity(IntPtr.Zero, -1, IntPtr.Zero, IntPtr.Zero, 4, 3, IntPtr.Zero, 0, IntPtr.Zero);
2. ran dcomcnfg.exe and changed Default Authentication Level to Default and Default Impersonation Level to Impersonate.
3. Changed the "Log On" settings for the service to use my account/password.
None of these change the situation - however, I still feel it may be a security issue. If I run my app NOT as a service, it works fine.
What's going on here???
Matt