473,618 Members | 3,005 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

attaching to COM process in windows service

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.Threadin g.Thread.Curren tThread.Apartme ntState = ApartmentState. STA;
int ret = CoInitializeSec urity(IntPtr.Ze ro, -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

Jul 21 '05 #1
0 1352

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1231
by: belgi | last post by:
Hi, I have a working windows service,it is looking for files on the disk and when some of the files are cupdated it calls an executable. But it takes a lot of time(about 10 minutes) to run the executable.So while that executable is running,if I try to stop the windows service while
0
881
by: Trokey | last post by:
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 =...
3
5127
by: belgiozen | last post by:
Hi, I have a working windows service,it is looking for files on the disk and when some of the files are cupdated it calls an executable. But it takes a lot of time(about 10 minutes) to run the executable.So while that executable is running,if I try to stop the windows service while the executable(MYPROGRAM.EXE) is running,it will wait for a time(about 20 seconds) for the main windows thread to abort.If it does not finish its work, the...
4
15528
by: Primo | last post by:
Hi, This problem has been frustrating me for days and I hope you experts can help me out. I am trying to run a command, which I would normally run from the command line, from within my C# application. The command runs successfully from a Windows Form but fails if the application is recasted as a Windows service. The application is essentially a File Watcher that should run the process when a file is dropped into a specific directory. ...
4
2383
by: Mrinal Kamboj | last post by:
Hi , Doubt may be bit trivial , but i wanted to know , what are the exact benefits derived while we run a background process as an NT service in windows , we can as well achieve the functionality using standalone exe , which will keep on running in a loop and do the job till been messaged to stop . Essentially , i want the key advantages of implementing process daemons as an NT Service in windows .
4
5244
by: Greg P | last post by:
I know this is a long post, please bear with me. I have been working on this all weekend to no avail although I have done a good amount of research (see most pertinent links that I've looked at below). Please help me get through this!!! I'm having some serious problems attaching a .mdf file and accessing it. I have a WroxUntied.mdf that I want to attach and then run the website that uses it. This is a .mdf file from wrox books. ...
5
4478
by: Benzi Eilon | last post by:
I have written a C# application which should run as a Windows Service. I must avoid having multiple instances of the application on one machine so I inserted the following code at the beginning of the Main() function: // if this is not the first instance of this application, exit // immediately. Allow only one instance in the system if (Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName).Length > 1)
3
6065
by: Rico | last post by:
Hello, I have a windows service that I have created in VB 2005. I have it installed, and running, but it's not functioning correctly. When I try to "Attach to process", my service is greyed out in the list and I cannot attach to it. Any idea why? Any help would be greatly appreicated. Thank you, Rick
4
8828
by: Steven De Smet | last post by:
Hello, This is my first post. I searched on the internet for answers but I was unable to solve my problem. So I hope that you guy's can help me with my VB.NET problem I tried to create a windows service that converts MS Word Files into .PDF files and after that we want to zip the .PDF files. Our code: Protected Overrides Sub OnStart(ByVal args() As String) ' Add code here to start your service. This method should set...
0
8212
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8153
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8653
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8455
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7126
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5552
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2587
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1760
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1459
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.