all groups > dotnet web services > february 2007 >
You're in the

dotnet web services

group:

Excel instance remains after closing, calling GC, setting to null


Excel instance remains after closing, calling GC, setting to null John Bailo
2/22/2007 12:03:11 PM
dotnet web services:
I wrote a c# web service that creates an Excel spreadsheet. Even
though I follow all the formal procedures for closing the app and
finalizing, an instance of Excel still remains in memory.

I follow the procedures described here:

http://blogs.geekdojo.net/richardhsu/archive/2003/11/14/281.aspx

Yet, excel.exe stays there with IUSR_ as the owner.

I'm trying to get rid of this instance once the method ends.

BTW -- if I use the exact same code in a c# console application, the
instance does go away!


Re: Excel instance remains after closing, calling GC, setting to null Mark Fitzpatrick
2/22/2007 8:49:43 PM
You're also positive you're clearning all the com references as mentioned in
the comments to that entry. Keep in mind, Excel should never really be used
on the server. It's not designed to be called from ASP.Net or a web service.
It's the wrong threading model. You can end up with numerous copies of Excel
running and MS doesn't recommend this at all. There are lots of third-party
components that are written in managed code and may do what you need.
Personally, I've used the one from Component1 but there are lots of others
out there.


--

Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006

[quoted text, click to view]

AddThis Social Bookmark Button