ASP.NET application freezes when COM object is instantiated

R

Ralf Müller

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++) {
....
}
}
 
S

Scott Allen

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,
 
R

Ralf Müller

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,563
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top