473,790 Members | 3,246 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Windows Service keeps process open.

gb
I have a Windows Service that watches a directory using the FileSystemWatch er. When an Excel spreadsheet gets added to that directory, the Windows Service calls a routine that opens the Excel spreadsheet and does some processing (on a seperate thread). After processing is done on the spreadsheet, it is closed and the reference is set to Nothing. However, if you go to the Task Manager, the Excel process is still there. Each time the Service processes a new Excel spreadsheet, a new Excel process is in the Task Manager. Even after stopping the Service, the Excel processes are still in the Task Manager

How do you get the Excel processes in the Task Manager to go away? Any help is appreciated. Thanks.
Nov 20 '05 #1
3 1327
gb
The code quits the Excel application and sets the reference to Nothing. What else should I need to do? For example

Dim oXL as Excel.Applicati o
Dim oWB as Excel.WorkBoo
'Do some processing stuf
'Before the routine exits, the below is don
oWB = Nothin
oXL.Quit(
oXL = Nothin

I thought that would be enough, but the Excel Processes are still in the Task Manager.
Nov 20 '05 #2
* "=?Utf-8?B?Z2I=?=" <an*******@disc ussions.microso ft.com> scripsit:
I have a Windows Service that watches a directory using the
FileSystemWatch er. When an Excel spreadsheet gets added to that
directory, the Windows Service calls a routine that opens the Excel
spreadsheet and does some processing (on a seperate thread).


Don't do Office automation in a service, that's not recommended:

<URL:http://support.microso ft.com/?kbid=257757>

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #3
On Fri, 23 Apr 2004 14:01:08 -0700, gb wrote:
The code quits the Excel application and sets the reference to Nothing. What else should I need to do? For example:

Dim oXL as Excel.Applicati on
Dim oWB as Excel.WorkBook
'Do some processing stuff
'Before the routine exits, the below is done
oWB = Nothing
oXL.Quit()
oXL = Nothing

I thought that would be enough, but the Excel Processes are still in the Task Manager.


I notice that the code above does not close the workbook. Is that
necessary?

I'm haven't done much office automation, but have you tried calling the
ReleaseComObjec t method?

Marshal.Release ComObject(oXL)

Just some thoughts
--
Chris

To send me an E-mail, remove the underscores and lunchmeat from my E-Mail
address.
Nov 20 '05 #4

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

Similar topics

2
3251
by: Bill | last post by:
I created a Windows Service (written in VB.NET) that uses a FileSystemWatcher to monitor a directory for file creation. When files with a certain extension are created in the directory, the file is opened and read (something is done with the contents). Then the file is moved to a backup directory. Everything works fine when the coe runs as a standard Windows app, but when I run the code as a Windows Service, I get the following error when...
2
15696
by: andrewcw | last post by:
I am trying to do a windows service with C#. I am using as a base the VB.NET article in VS, but I thing the WITHEVENTS timer notation is a delegate. Can anyone provide sample code & anh hints. Thanks Andrew
0
3404
by: Ross Bennett | last post by:
Ahoy, Folks! I've been looking all over for this, but I just can't seem to shake any documentation out of the MSDN or from Google. I've reviewed every .NET article on developing Windows Services in the MSDN I've located. I'm developing a Windows Service application. This service reads its configuration data from the system registry (HKLM) where it was deposited by another "manager" application. No problems there.
2
2231
by: Razzie | last post by:
Hey all, I wrote a Windows Service. When I test it on my developement machine (winXP) it works fine. It starts ok, never crashes, etc. When I install the service on another machine (win2000) it *sometimes* crashes upon starting. The progressbar you get when you manually start the server will very slowly progress, and when it hits 100% after 2 minutes or something I get the error 'The service could not be started because it did not...
9
7273
by: SP | last post by:
Hi All, I wrote a windows service which is supposed to stop after specified amount of time. I am calling OnStop() after specified time. OnStop() methods executed but I dont see the service stopping. Please advise how to stop the service. Thanks, SP
3
57004
by: Jeremy S. | last post by:
On my dev machine (XP/Pro with VS.NET 2003) I have been developing a Windows Service and installing it on the local machine by opening the Visual Studio Command Prompt and then executing . Now I want to test this service on a Windows Server 2003 box that doesn't have the Visual Studio Command prompt. How do I go about installing the service on the Windows Server 2003 box? Thanks!
4
2425
by: Kristof Despiere | last post by:
Suppose you have one domain, filled with a couple of users. What needs to be done now is I need to start a windows application from a webform by pressing a button on the webform (for example). The problem is that the user who "owns" the service is always the ASPNET account. That's not good since you don't see the actual application (because it's owned by ASPNET). I've tried changed the processmodel section in the machine.config file to...
4
2023
by: stuart.jones | last post by:
Dear all I have a Windows Service that retrieves some data as XML, applies an XSLT to produce a CSV which is saved to the filesystem as a text file. This all works fine. Depending upon the configuration, this file is then 1. copied to another location 2. attached to an e-mail message 3. FTPed to a particular location
2
4022
by: Sourcerer | last post by:
I posted these on another group, but was redirected here, so here are my two posts and my questions: Post #1: I've started my first practice windows service project in C#, and I'm already stuck. Let's say I'm trying to make a simple service (and useless, but good for practice). It is supposed to listen on port which is stored in its configuration
0
9666
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
10419
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...
1
10147
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9987
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
9023
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
5424
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4100
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
2
3709
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2910
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.