By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,346 Members | 2,331 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,346 IT Pros & Developers. It's quick & easy.

ASP.NET application freezes when COM object is instantiated

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.