Hi,
I have a routine which is call from a ASP.NET web form. This routine creates
an excel application, opens a workbook , runs some code to update the
workbook, saves it as HTML on the sever and returns to the Web form to
display.
All is OK, except EXCEL remains in the process list in task manager.
I am following all guideline in releasing the com components.
Regards
Tim 11 2249
I'm assuming you mean its running on the server and not client?
and could you show how you release this component and call it.
--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Tim Marsden" <TM@UK.COM> wrote in message
news:u7******** ******@TK2MSFTN GP10.phx.gbl... Hi,
I have a routine which is call from a ASP.NET web form. This routine
creates an excel application, opens a workbook , runs some code to update the workbook, saves it as HTML on the sever and returns to the Web form to display.
All is OK, except EXCEL remains in the process list in task manager. I am following all guideline in releasing the com components.
Regards Tim
Many thanks for reply.
Yes, you are correct it is on the server, I am aware of the licensing issues
and lack of support from Microsoft.
Code section
Dim objExcelApplica tion As Excel.Applicati on
Dim objWorkbook As Excel.Workbook
Dim objWorkbooks As Excel.Workbooks
Dim objWorksheets As Excel.Worksheet s
Dim objWorksheet As Excel.Worksheet
Dim dsExcelMenu As rdsExcelMenu
Try
Try
objExcelApplica tion = New Excel.Applicati on
objExcelApplica tion.Visible = False
objExcelApplica tion.DisplayAle rts = False
Catch ex As Exception
'>>> Excel Error
Throw ex
End Try
Try
objWorkbooks = objExcelApplica tion.Workbooks
objWorkbooks.Op en(strWorkbook, False, True)
objWorkbook = objWorkbooks.It em(1)
Catch ex As Exception
'>>> Workbook Open Error
Throw ex
End Try
** process here etc
Catch ex As Exception
Throw ex
Finally
If Not objWorksheet Is Nothing Then
ReleaseComObjec t(objWorksheet)
End If
If Not objWorksheets Is Nothing Then
ReleaseComObjec t(objWorksheets )
End If
If Not objWorkbook Is Nothing Then
objWorkbook.Clo se(False)
ReleaseComObjec t(objWorkbook)
End If
If Not objWorkbooks Is Nothing Then
ReleaseComObjec t(objWorkbooks)
End If
If Not objExcelApplica tion Is Nothing Then
objExcelApplica tion.Quit()
ReleaseComObjec t(objExcelAppli cation)
End If
GC.Collect()
GC.WaitForPendi ngFinalizers()
End Try
'============== =============== =============== =============== =====
Private Sub ReleaseComObjec t(ByRef Reference As Object)
Try
Do Until
System.Runtime. InteropServices .Marshal.Releas eComObject(Refe rence) <= 0
Loop
Catch
Finally
Reference = Nothing
GC.Collect()
End Try
End Sub
"Curt_C [MVP]" <software_AT_da rkfalz.com> wrote in message
news:eP******** ******@TK2MSFTN GP10.phx.gbl... I'm assuming you mean its running on the server and not client? and could you show how you release this component and call it.
-- Curt Christianson Owner/Lead Developer, DF-Software Site: http://www.Darkfalz.com Blog: http://blog.Darkfalz.com
"Tim Marsden" <TM@UK.COM> wrote in message news:u7******** ******@TK2MSFTN GP10.phx.gbl... Hi,
I have a routine which is call from a ASP.NET web form. This routine creates an excel application, opens a workbook , runs some code to update the workbook, saves it as HTML on the sever and returns to the Web form to display.
All is OK, except EXCEL remains in the process list in task manager. I am following all guideline in releasing the com components.
Regards Tim
this is expected behavior. you will have to add code to kill the process if
you want it to go away.
-- bruce (sqlwork.com)
"Tim Marsden" <TM@UK.COM> wrote in message
news:u7******** ******@TK2MSFTN GP10.phx.gbl... Hi,
I have a routine which is call from a ASP.NET web form. This routine
creates an excel application, opens a workbook , runs some code to update the workbook, saves it as HTML on the sever and returns to the Web form to display.
All is OK, except EXCEL remains in the process list in task manager. I am following all guideline in releasing the com components.
Regards Tim
I'm inclined to agree that this would be "expected" behavior - if you've paid your dues and discovered it through trial-and-error. But it seems like Tim Marsden read MS doccumentation and "expected" things to work as advertised
What you are saying makes sense. Setting the application object to nothing doesn't seem to get the job done. You have to kill the process. Got any sample code?
Thanks for your thoughts
I can kill a process easily, but how do I identify the Excel process which
was started by my app, and not other running Excel processes.
Tim
"Rich" <an*******@disc ussions.microso ft.com> wrote in message
news:98******** *************** ***********@mic rosoft.com... I'm inclined to agree that this would be "expected" behavior - if you've
paid your dues and discovered it through trial-and-error. But it seems like
Tim Marsden read MS doccumentation and "expected" things to work as
advertised. What you are saying makes sense. Setting the application object to
nothing doesn't seem to get the job done. You have to kill the process.
Got any sample code?
How many instances of Excel are you planning on having running at the same
time on your server? Hint: your server will likely choke on more than one.
You may have noticed that even a single instance of Excel runs rather
slugishly on a web server.
Read this article if you haven't already: http://www.aspnetpro.com/NewsletterA...200309so_l.asp
--
I hope this helps,
Steve C. Orr, MCSD, MVP http://Steve.Orr.net
"Tim Marsden" <TM@UK.COM> wrote in message
news:Om******** ******@TK2MSFTN GP11.phx.gbl... Thanks for your thoughts
I can kill a process easily, but how do I identify the Excel process which was started by my app, and not other running Excel processes.
Tim
"Rich" <an*******@disc ussions.microso ft.com> wrote in message news:98******** *************** ***********@mic rosoft.com... I'm inclined to agree that this would be "expected" behavior - if you've paid your dues and discovered it through trial-and-error. But it seems
like Tim Marsden read MS doccumentation and "expected" things to work as advertised. What you are saying makes sense. Setting the application object to
nothing doesn't seem to get the job done. You have to kill the process. Got any sample code?
Hi
Thanks Steve, I have read your excellent article and it very enlightening
I have realised the problems with Excel.
I am now planning on moving the Excel processing one to another dedicated
machine. With queuing and first come first served type basis, I just need to
work out the mechanisms.
If anyone has ideas on how I can achieve this I would be grateful.
I have gone to far down this path to abandon the idea. (client request).
My app is primarily local excel based, however I need a way of serving over
the intranet.
Regards
Tim
"Steve C. Orr [MVP, MCSD]" <St***@Orr.ne t> wrote in message
news:uA******** ******@TK2MSFTN GP11.phx.gbl... How many instances of Excel are you planning on having running at the same time on your server? Hint: your server will likely choke on more than
one. You may have noticed that even a single instance of Excel runs rather slugishly on a web server. Read this article if you haven't already: http://www.aspnetpro.com/NewsletterA...200309so_l.asp -- I hope this helps, Steve C. Orr, MCSD, MVP http://Steve.Orr.net
"Tim Marsden" <TM@UK.COM> wrote in message news:Om******** ******@TK2MSFTN GP11.phx.gbl... Thanks for your thoughts
I can kill a process easily, but how do I identify the Excel process
which was started by my app, and not other running Excel processes.
Tim
"Rich" <an*******@disc ussions.microso ft.com> wrote in message news:98******** *************** ***********@mic rosoft.com... I'm inclined to agree that this would be "expected" behavior - if
you've paid your dues and discovered it through trial-and-error. But it seems like Tim Marsden read MS doccumentation and "expected" things to work as advertised. What you are saying makes sense. Setting the application object to
nothing doesn't seem to get the job done. You have to kill the process. Got any sample code?
You can use System.Runtime. InteropServices .Marshal.Releas eComObject(xxx) for
each excel object that you work with, i.e. ranges, worksheets, workbooks,
and the excel app itself. After that, set each of the objects to Nothing.
When this is done, you can call GC.Collect, followed by
GC.WaitForPendi ngFinalizers().
The docs say never to call GC.Collect, but it will free the 25 MB + of
memory excel is using, so its ok. Excel was never meant to be used as a
server side app, and there are 3rd party products you can buy that will
perform better.
Hope this helps.
--
Eric Marvets
Principal Consultant
the bang project
<shameless self promotion>
Email sa*********@ban gREMOVETHISproj ect.com for Information on Our
Architecture and Mentoring Services
</shameless self promotion>
Thanks Eric
As your can see from my early post, I am doing the steps you recommend, but
the Excel is still resident.
I will try a different approach. Thanks for your time.
Regards
Tim
"Eric Marvets" <er*********@ba ngREMOVETHISpro ject.com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. .. You can use System.Runtime. InteropServices .Marshal.Releas eComObject(xxx)
for each excel object that you work with, i.e. ranges, worksheets, workbooks, and the excel app itself. After that, set each of the objects to Nothing. When this is done, you can call GC.Collect, followed by GC.WaitForPendi ngFinalizers().
The docs say never to call GC.Collect, but it will free the 25 MB + of memory excel is using, so its ok. Excel was never meant to be used as a server side app, and there are 3rd party products you can buy that will perform better.
Hope this helps.
-- Eric Marvets Principal Consultant
the bang project
<shameless self promotion>
Email sa*********@ban gREMOVETHISproj ect.com for Information on Our Architecture and Mentoring Services
</shameless self promotion>
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: taylor.bryant |
last post by:
I am running:
Win XP SP2
Excel 2002, Access 2002 (Office XP SP3)
Using Visual Basic (not VB.NET)
At one point (prior to XP SP2?!? - I can't pin it down), this did
not happen and I was easily able to destroy instances of excel (with
the exact same code). I have read many, many posts, and they seem to
get bogged down in specifics. So I cribbed this program from the
automation help file, simplified it further, so hopefully someone can
|
by: Stephen Brooker |
last post by:
Hi all,
Just playing around a MS how-to sample to work with an Excel file from
within C#. Everything is fine and I understand it OK, however when Excel
and the application are closed, there is still an Excel process showing
up in the task manager. Every time the app is run, another process shows
up for Excel and always stays there. The only way to get rid of it is to
kill it manually.
So my question is, what is the correct way of...
|
by: Praveen K |
last post by:
I have a problem in communicating between the C# and the Excel Interop
objects. The problem is something as described below.
I use Microsoft Office-XP PIA dll’s as these dll’s were been recommended by
many for web applications. I create the instances of Excel, Workbook and the
worksheet. And later on Release the references by
“System.Runtime.InteropServices.Marshal.ReleaseComObject(Object)” and making
the object as null finally....
|
by: Steve Richter |
last post by:
I am getting error in a vbscript:
ActiveX component cant create object: Excel.Application.
The vbscript code is:
Dim objExcel
Set objExcel = CreateObject("Excel.Application")
I am pretty sure it is a permission issue because the script works when
I point the browser directly at the .htm file on the c: drive:
c:\inetpub\wwwroot\DemoSite\VbScriptTest.htm
|
by: elziko |
last post by:
I'm using late binding (I must) to automate Excel.
My code opens Excel after createing and poulating some sheets. My problem is
that when the user finally decides to close Excel its process is left
running until my application closes.
I have tried setting my Excel.Application object to Nothing.
I have tried to then fore the GC into action using:
| |
by: ChrisFrohlich |
last post by:
I have been trying to use the Office PIA's to write an ASP.NEt page to:
1. Open a template workbook
2. Populate some data
3. Save the file back to the server
4. Quit Excel and free up Memory
I have been able to do all of the above steps except #4. Each time
Excel.exe persists in memory. I have already referred to Q317109 "Office
application does not quit after automation from Visual Studio .NET client"
without much luck.
|
by: myname |
last post by:
Hello,
in VB.Net, I use Excel to display results :
dim xl as new Excel.Application // creates an Excel process
// snip (putting values into cells)
xl.Visible = true
If the user closes the Excel file, the Excel process remains
in memory until my program is closed, which is good.
|
by: Brandon |
last post by:
Hi all,
I'm currently working on a project where we have a need to expose an
Excel spreadsheet on the web as a webservice that needs to be reliable
and available 24x7x365. I've implemented a prototype of this in python
using the win32com library to interface with the Excel Automation API
via COM. I've also used web.py as a way to expose this automation
functionality to the network. This works just fine as a prototype that
proves that...
|
by: =?Utf-8?B?VGVycnkgSG9sbGFuZA==?= |
last post by:
I have a vb.net app that opens an excel worksheet, reads data and then closes
the sheet. Im noticing that the Excel process is still running after I have
closed and disposed of my excel objects.
The following code (Test1) demonstrates the essence of what I am doing.
When I check the processes while ruinning the method, I notice that the Excel
process remains after exiting the sub (and until I exit the application)
Sub Test1
Dim...
|
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, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look !
Part I. Meaning of...
|
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,...
| |
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...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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,...
|
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...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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...
| |
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...
| |