Bug in Interop?

M

Michael

Hi, we have a small web service that calls into some VB6
com components. There is only one call to these
components and this is done on a new thread in order to
use impersonation. The problem is that on every other
call into the Com components the aspnet_wp.exe throws an
unhandled exception " 0xC0000005: Access violation
reading location " and recycles itself.

Has anyone else ran into this. Not sure what could be
causing this. Any ideas?

Also, releasecomobject is being called and even tried
garbage collecting......

Thanks for any insight....
 
C

Chris Botha

Michael, you don't need a new thread for impersonation, switch off anonymous
access to the web app and put
<identity impersonate="true" />
in your web.config file under the line <system.web> and use the main
thread and see what it does (for sure VB6 com components are not thread
safe, but it may be irrelevant in your case).
 
G

Guest

From what I have read you need to create a new thread in
a web service when accessing Com components. This is not
true when working with Asp.net. Only web services...
 
C

Chris Botha

Hi.

This is interesting. Can you remember where you read it? I'm asking,
because I don't do it.

Thanks.
 
C

Chris Botha

I had a look at the article, frightening.
What I said in my first response above was you don't have to use a second
thread in order to impersonate. I'm calling COM components with
impersonation from the main thread, and it works - after reading the article
I'm a bit nervous though. In any case, this is what I do
(1) Take off anonymous access to the virtual directory (Internet Services
Manager)
(2) Make the following entry in the web.config file, under the line that
says "<system.web>", put a line
"<identity impersonate="true"/>"

Now you should be able to call the WEB Service from IE already, however, if
you use a Windows app that calls the service, then you may have to call
myService.Credentials = new NetworkCredential(...) or use the
DefaultCredentials.
Note that you can also "hard-code" the UserName/Password in the web.config
file, have a look at
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsent7/html/vxconimpersonation.asp

Please let me know if this works, so I can shrug off the nervousness.
 

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

Forum statistics

Threads
473,995
Messages
2,570,225
Members
46,815
Latest member
treekmostly22

Latest Threads

Top