underlying connection was closed: unable to connect to the remote server: COM --> .Net --> WebServic


M

Monty

OK, I had an issue with this and found lots of advice that did not apply, so
I'm posting what I found hoping it might help someone else. Here's the
sitch: you have a COM app that calls to a .Net assembly which in turn calls
a web service. You know the web service is reachable and that the COM app is
able to instantiate your .Net assembly (because you RegAsm'ed it and it's
good to go). However, when you attempt to make a call to the web service you
get the error message "underlying connection was closed: unable to connect
to the remote server". Chances are, you've had people telling you this is a
proxy issue even though you're pretty sure it's not. OK, here's what saved
me: simply add your assembly to the GAC. That's it. Even if you've RegAsm'ed
the heck outta your assembly and the COM object has no problems
instantiating it, I got this error every time it made a call to the
webservice until I added it to the GAC, then it worked like magic.

If anyone knows why this is, please chime in. Thanks.

Keywords: COM, ASMX, Web Service, Web Services, interop, REGASM, GACUTIL,
CCW, Register for COM, proxy, proxies, "underlying connection was closed:
unable to connect to the remote server"
 
Ad

Advertisements

J

John Saunders

Monty said:
OK, I had an issue with this and found lots of advice that did not apply,
so I'm posting what I found hoping it might help someone else. Here's the
sitch: you have a COM app that calls to a .Net assembly which in turn
calls a web service. You know the web service is reachable and that the
COM app is able to instantiate your .Net assembly (because you RegAsm'ed
it and it's good to go). However, when you attempt to make a call to the
web service you get the error message "underlying connection was closed:
unable to connect to the remote server". Chances are, you've had people
telling you this is a proxy issue even though you're pretty sure it's not.
OK, here's what saved me: simply add your assembly to the GAC. That's it.
Even if you've RegAsm'ed the heck outta your assembly and the COM object
has no problems instantiating it, I got this error every time it made a
call to the webservice until I added it to the GAC, then it worked like
magic.

If anyone knows why this is, please chime in. Thanks.

I wonder if this is a trust issue.

John
 
D

David Betz

I'm surprised you aren't getting threading errors... COM's not supposed
to do stuff like that.

Try switching everything to COM+ (Enterprise Services)... that ALWAYS
works for me. I just many applications via Enterprise Services.
 
Ad

Advertisements

M

Monty

Hi David,

It seems to be working fine now that it's in the GAC. What exactly is COM
not supposed to do? Can you point me towards any docs on this?
Thanks
 

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

Top