473,473 Members | 1,742 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

using a COM in web application


Is there any issue in using COM component in web applications. The
problem I'm facing are

1. Though the dll is using non-static member variables which are being
instantiated on each call, Whenever I'm calling the (.aspx) pages using
the dll more than once simultaneously, both results in garbage. When
called once it is perfect in result.
2. The memory is not being released in web application of the dll even
after finishing properly with result. Again it is perfect when using in
non-web application (say VB exe application). Actually, the dll is using
PowerPoint classes and opening a ppt file. And the PowerPoint is
releasing memory long after.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #1
6 1375
Hi,

are u releasing the COM object after using it by setting it to null (C#) or
nothing (VB). Because we cannot predict the behavior of the CLR GC, you must
explicitly de reference your heavy objects. I hope that would help.

Regards
Joyjit

"Amitava Sengupta" <it********@rediffmail.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...

Is there any issue in using COM component in web applications. The
problem I'm facing are

1. Though the dll is using non-static member variables which are being
instantiated on each call, Whenever I'm calling the (.aspx) pages using
the dll more than once simultaneously, both results in garbage. When
called once it is perfect in result.
2. The memory is not being released in web application of the dll even
after finishing properly with result. Again it is perfect when using in
non-web application (say VB exe application). Actually, the dll is using
PowerPoint classes and opening a ppt file. And the PowerPoint is
releasing memory long after.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 18 '05 #2
Yes Joyjit,

Dereferencing is done explicitly. But ...

Regards
Amitava

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #3
Hi,

try Marshal.ReleaseComObject(object your comobject) if that works.

Regards
Joyjit

"Amitava Sengupta" <it********@rediffmail.com> wrote in message
news:ex**************@TK2MSFTNGP10.phx.gbl...
Yes Joyjit,

Dereferencing is done explicitly. But ...

Regards
Amitava

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 18 '05 #4
I just lived through this.

If there's any possible way to get around using ASP.NET to automate office,
then do it, Run screaming into the hells and never look back, chilld!!

Here's the thing. If you scour the microsoft site, they strongly recomment
that you don't do this. The COM objects dont end up geting released, even
if you tell them to through Marshall.ReleaseComObject. What happens is that
for every "thing" that you reference, you have to distroy the reference
explicitly with ReleaseComObject. For example, if you were using an excel
spreadsheet and all you wanted to do was open a workbook and change the
value of a single cell, you would have to create explicit variables for the
(here we go) Application, WordbooksCollection, ActiveSheet, ActiveSheetRange
and the Cell you're referring to. If you want to refer to 20 different
cells, then you have to create a reference to each cell explicitly and then
explicitly call ReleaseCOMObject on every one. Forget a single cell and
you're toast.

In the case of PowerPoint, you'd have to create a seperate variable for
every shape. presentation, slide and textbox you use. You can't reassign a
variable because when the reference is changed, you can't call
ReleaseCOMObject on it.

I ended up haveing to use Word and Excel for a project, under duress. As a
result, we had to resolve the issue with the following approach.

Only one instance of the application word can exist at any time
Only one instance of the application excel can exist at any time
Don't directly Create an instance of the applicationClass. Delegate that to
a worker function (e.g. GetWordInstance)
GetWordInstance performs the following actions:
Execute System.Diagnostics.Process.GetProcessesByName("MSW ORD")
If no processes exist, then create a new Word.ApplicationClass and return
it
If a process does exist, wait 1/5 second and try again.
If a total of 20 seconds pass without being able to create a word
application then throw an exception

When you are finished with the Word Application, you have to call a
releaseWordInstance function which does the following
Execute System.Diagnostics.Process.GetProcessesByName("MSW ORD")
For each Process taht is returned, kill it!

I hate that we had to do this, but it was the only soution that we could
come up with.


"Amitava Sengupta" <it********@rediffmail.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...

Is there any issue in using COM component in web applications. The
problem I'm facing are

1. Though the dll is using non-static member variables which are being
instantiated on each call, Whenever I'm calling the (.aspx) pages using
the dll more than once simultaneously, both results in garbage. When
called once it is perfect in result.
2. The memory is not being released in web application of the dll even
after finishing properly with result. Again it is perfect when using in
non-web application (say VB exe application). Actually, the dll is using
PowerPoint classes and opening a ppt file. And the PowerPoint is
releasing memory long after.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 18 '05 #5
Thanks Joyjit for ur interest in the matter. But every thing to release
a COM object or Garbage collection was done. Actually I tried many (if
not all) possible ways to release. Had there be any problem, I think the
COM would not have been worked for non-web (say VB exe) application.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #6
In addition to other's comments:

If the COM component is written in VB6, or the component has a
threading model of STA (single threaded apartment), then use
AspCompat="true" in your @ Page directive. This sets the ASPX page to
run in a compatible apartment and reduces some thread marshalling.
This would mostly be just for performance reasons, but can also change
the behavior of an application, if you are using impersonation for
instance.

HTH,
--
Scott
http://www.OdeToCode.com

On Mon, 23 Aug 2004 00:01:44 -0700, Amitava Sengupta
<it********@rediffmail.com> wrote:

Is there any issue in using COM component in web applications. The
problem I'm facing are

1. Though the dll is using non-static member variables which are being
instantiated on each call, Whenever I'm calling the (.aspx) pages using
the dll more than once simultaneously, both results in garbage. When
called once it is perfect in result.
2. The memory is not being released in web application of the dll even
after finishing properly with result. Again it is perfect when using in
non-web application (say VB exe application). Actually, the dll is using
PowerPoint classes and opening a ppt file. And the PowerPoint is
releasing memory long after.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Nov 18 '05 #7

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

Similar topics

11
by: Grasshopper | last post by:
Hi, I am automating Access reports to PDF using PDF Writer 6.0. I've created a DTS package to run the reports and schedule a job to run this DTS package. If I PC Anywhere into the server on...
12
by: Charlie | last post by:
Hi: My host will not allow me use a trusted connection or make registry setting, so I'm stuck trying find a way to hide connection string which will be stored in web.config file. If I encrypt...
14
by: pmud | last post by:
Hi, I need to use an Excel Sheet in ASP.NET application so that the users can enter (copy, paste ) large number of rows in this Excel Sheet. Also, Whatever the USER ENETRS needs to go to the...
12
by: John M | last post by:
Hello, On Microsoft Visual Studio .NET 2003, I want to use some global elements, that can be used in each one of my pages. i.e I put a oleDBConnection on global.asax.vb How can I use it...
5
by: Mike in Santa Rosa | last post by:
I'm trying to get a simple c# app built that can launch/manipulate an excel workbook, sheet. I've chased down several examples and can't any of them to work. So I must be doing somethnig obviouslt...
1
by: Screenbert | last post by:
After finding nothing anywhere in google I am posting this so everyone can benefit by it. The formating is not pretty since I copied it from my word document, but you should benefit by it. ...
0
by: screenbert | last post by:
Managing DHCP Servers using C# They said it was impossible. It couldn't be done. But you can in fact manage DHCP servers using C#. This includes creating and deleting Scopes, SuperScopes,...
8
by: inpuarg | last post by:
I 'm developing a c# (.net 2.0) windows forms application and in this application i want to connect to a java servlet page (HTTPS) (which is servlet 2.4 and which may be using Web Based SSO Sun...
0
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgS2lxdWVuZXQ=?= | last post by:
Hi all, I have a publishing Click Once of my application. Now I want create new version of my application for modify some files, like app.config.
0
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,...
0
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...
1
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...
1
isladogs
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...
0
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...
0
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...

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.