Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / September 2004

Tip: Looking for answers? Try searching our database.

Any news on the release Excel bug?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Lars-Erik Aabech - 09 Sep 2004 12:46 GMT
I'll just refer to
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&threadm=9DEB3050-8CBF-4E69-BC
9B-9FD22E8AE536%40microsoft.com&rnum=3&prev=/groups%3Fq%3Dexcel%2520quit%2520int
erop%2520process%2520asp.net%26num%3D20%26hl%3Den%26lr%3D%26ie%3DUTF-8%26sa%3DN%
26tab%3Dwg

and ask if the problem has got a solution yet..

I've got the following code  in a class library, and it doesn't release
Excel.exe when called from ASP.NET. Fifty page requests, and the server is
out of memory... That's nice :)

Any help to make it make Excel go away would be very much appreciated. :)

L-E

public int GetSheetCount(string path)
{

Application app = null;
Workbook wb = null;
int iRet = 0;
Exception outerEx = null;
try
{
   // Culture hack...
   System.Globalization.CultureInfo ciOld =
System.Threading.Thread.CurrentThread.CurrentCulture;
   System.Threading.Thread.CurrentThread.CurrentCulture = new
System.Globalization.CultureInfo("en-US");
   // End cult. hack. 1

   app = new ApplicationClass();
   app.DisplayAlerts = false;
   app.Visible = false;

   wb = app.Workbooks.Open(path, Missing.Value, Missing.Value,
Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value,
Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value);
   iRet = wb.Worksheets.Count;
   wb.Close(false, Missing.Value, Missing.Value);

   // Culture hack
   System.Threading.Thread.CurrentThread.CurrentCulture = ciOld;
   // End cuilt. hack 2
}
catch(Exception ex)
{
outerEx = ex;
}

Marshal.ReleaseComObject(wb);
wb = null;

app.Quit();
Marshal.ReleaseComObject(app);
app = null;

GC.Collect();
GC.WaitForPendingFinalizers();

// Excel process still active... ReleaseComObject() == 0 for both

if (outerEx != null)
throw(outerEx);

return iRet;

}
Paul Clement - 10 Sep 2004 14:38 GMT
¤ I'll just refer to
¤ http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&threadm=9DEB3050-8CBF-4E69-BC
9B-9FD22E8AE536%40microsoft.com&rnum=3&prev=/groups%3Fq%3Dexcel%2520quit%2520int
erop%2520process%2520asp.net%26num%3D20%26hl%3Den%26lr%3D%26ie%3DUTF-8%26sa%3DN%
26tab%3Dwg

¤ and ask if the problem has got a solution yet..
¤
¤ I've got the following code  in a class library, and it doesn't release
¤ Excel.exe when called from ASP.NET. Fifty page requests, and the server is
¤ out of memory... That's nice :)
¤

Unless it's client-side automation I doubt that it would be addressed. Server side automation with
the Microsoft Office applications via unattended or non-interactive client applications has too many
potential problems and as a result Microsoft does not support this type of implementation.

INFO: Considerations for Server-Side Automation of Office
http://support.microsoft.com/default.aspx?scid=kb;en-us;257757

Paul ~~~ pclement@ameritech.net
Microsoft MVP (Visual Basic)
Willy Denoyette [MVP] - 11 Sep 2004 23:20 GMT
The article you refer to has nothing in common with your problem.
You should know that Office products are not qualified to run in a server
environment and are not supported as MSFT said (see details in Paul's
reply).
One thing you could do is chack wheter you have set aspcompat= true in your
aspx page.
<%@ Page aspcompat="true" ...%>

Anyway, I can guarantee that if you continue to use Office from asp or
asp.net you are in for a lot of troubles.

Willy.

> I'll just refer to
> http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&threadm=9DEB3050-8CBF-4E69-BC
9B-9FD22E8AE536%40microsoft.com&rnum=3&prev=/groups%3Fq%3Dexcel%2520quit%2520int
erop%2520process%2520asp.net%26num%3D20%26hl%3Den%26lr%3D%26ie%3DUTF-8%26sa%3DN%
26tab%3Dwg

[quoted text clipped - 62 lines]
>
> }
Lars-Erik Aabech - 13 Sep 2004 11:08 GMT
Thanks guys. I've gotten the "INFO: Considerations for SS Automation of
Office" link in three forums by now. I can see it's a dead end.
I've rewritten the current code to use ADO instead since it's only going to
fetch information. It will do for now.

Hope there will be some improvements in office 2005 (?) though :)
Lots of users want this functionality...

Lars-Erik

> I'll just refer to

http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&threadm=9DEB3050-8CBF-4E69-BC
9B-9FD22E8AE536%40microsoft.com&rnum=3&prev=/groups%3Fq%3Dexcel%2520quit%2520int
erop%2520process%2520asp.net%26num%3D20%26hl%3Den%26lr%3D%26ie%3DUTF-8%26sa%3DN%
26tab%3Dwg

> and ask if the problem has got a solution yet..
>
[quoted text clipped - 29 lines]
> Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value,
> Missing.Value, Missing.Value, Missing.Value, Missing.Value,
Missing.Value);
>     iRet = wb.Worksheets.Count;
>     wb.Close(false, Missing.Value, Missing.Value);
[quoted text clipped - 26 lines]
>
> }

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.