473,324 Members | 1,678 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

ASP.NET application freezes when COM object is instantiated

In a WindowsForms application it works just fine. Why not in ASP.NET?

The interop assembly used was in both cases auto-generated by Visual Studio
..NET from the same .dll

The code is exactly the same in WindowsForms and WebForms:

private void button1_Click(object sender, System.EventArgs e) {
ImyCOMObject obj = new myCOMObjectClass(); // ASP.NET freezes here -
WindowsForm works perfectly
ISearchResult res = obj.Search(tbSearch.Text);
int count = res.Count;
for(int i = 0; i < res.Count; i++) {
....
}
}
Nov 19 '05 #1
3 1286
Do you know if the COM component uses the STA threading model? If so, you'll
need aspcompt="true" in your @ Page directive to set a compatible apartment
model for the thread executing the aspx page.

HTH,

--
Scott
http://www.OdeToCode.com/blogs/scott/
In a WindowsForms application it works just fine. Why not in ASP.NET?

The interop assembly used was in both cases auto-generated by Visual
Studio ..NET from the same .dll

The code is exactly the same in WindowsForms and WebForms:

private void button1_Click(object sender, System.EventArgs e) {
ImyCOMObject obj = new myCOMObjectClass(); // ASP.NET freezes
here -
WindowsForm works perfectly
ISearchResult res = obj.Search(tbSearch.Text);
int count = res.Count;
for(int i = 0; i < res.Count; i++) {
....
}
}

Nov 19 '05 #2
You need to set aspcompat=true. For more details about aspcompat, check out
this article
http://www.aspnetfaq.com/default.asp...&SearchString=

--
-Saravana
http://dotnetjunkies.com/WebLog/saravana/
www.ExtremeExperts.com

"Ralf Müller" <mu*****@julitec.de> wrote in message
news:Op**************@TK2MSFTNGP14.phx.gbl...
In a WindowsForms application it works just fine. Why not in ASP.NET?

The interop assembly used was in both cases auto-generated by Visual Studio .NET from the same .dll

The code is exactly the same in WindowsForms and WebForms:

private void button1_Click(object sender, System.EventArgs e) {
ImyCOMObject obj = new myCOMObjectClass(); // ASP.NET freezes here -
WindowsForm works perfectly
ISearchResult res = obj.Search(tbSearch.Text);
int count = res.Count;
for(int i = 0; i < res.Count; i++) {
....
}
}

Nov 19 '05 #3
Thank you, Saravana and Scott! It works... somehow. And it works even better
since I've found out how to destroy my COM-Object again.
But I've got one weird problem left: The interface "IAdresse" in the interop
library offers a property called "AnsprechpartnerCount" which is of type
int. This property works fine in the WindowsForms application but gives me a
COMException when using it in my WebApplication. Are there any other
differences between COM handling in ASP.NET and Windows Forms I should know
about?

Greetings, Ralf

"Saravana" <sa******@sct.co.in> schrieb im Newsbeitrag
news:#6**************@tk2msftngp13.phx.gbl...
You need to set aspcompat=true. For more details about aspcompat, check out this article
http://www.aspnetfaq.com/default.asp...&SearchString=
--
-Saravana
http://dotnetjunkies.com/WebLog/saravana/
www.ExtremeExperts.com

"Ralf Müller" <mu*****@julitec.de> wrote in message
news:Op**************@TK2MSFTNGP14.phx.gbl...
In a WindowsForms application it works just fine. Why not in ASP.NET?

The interop assembly used was in both cases auto-generated by Visual

Studio
.NET from the same .dll

The code is exactly the same in WindowsForms and WebForms:

private void button1_Click(object sender, System.EventArgs e) {
ImyCOMObject obj = new myCOMObjectClass(); // ASP.NET freezes here - WindowsForm works perfectly
ISearchResult res = obj.Search(tbSearch.Text);
int count = res.Count;
for(int i = 0; i < res.Count; i++) {
....
}
}


Nov 19 '05 #4

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

Similar topics

4
by: Keith Chadwick | last post by:
I am having some trouble referencing an Application("myVar") variable from within a module.vb file on my ASP.NET site. According to the documentation I should be able to reference...
20
by: J-T | last post by:
We are working on an asp.net application which is a 3-tier application.I was aksed to create a component which monitors a folder and gets the file and pass them to a class library in our business...
1
by: Yahya Saad | last post by:
Dear All, I have upgraded and application I developed on VB6 which uses the Mscomm1 component and reads from COM1 port data send, then sends these records to a table in SQL 2000. I upgraded the...
15
by: dn | last post by:
I'm starting an n-tier application with an ASP.NET 2.0 presentation layer, a business layer, a data access layer, and a SQL Server 2005 database, and I have a question. In the business and data...
2
by: Sebastian Crewe | last post by:
Greetings, I was much encouraged to see the new BackgroundWorker class in .NET v2. On the face of it, much easier to use than the various delegates and events of yore, though I imagine the same...
13
by: michel | last post by:
Hi, i created a class 'test' with a method 'descrlimit()' (no matter). That method is used in a lot of pages in the application, so i need to put this code a lot of time: "Dim odescr As New...
0
by: m m | last post by:
I'm developing an ASP.NET 1.1 application which produces several bar- code images (PDF417 format). The bar-code producer is a class that converts clear text into bar- code bitmap using a special...
6
by: dolulob | last post by:
Hi, I'm trying to communicate with a console application through a c# program. the console application is micq a console based ICQ client. I want to be able to send an receive messages through...
12
by: raylopez99 | last post by:
Keywords: scope resolution, passing classes between parent and child forms, parameter constructor method, normal constructor, default constructor, forward reference, sharing classes between forms....
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.