Hi people,

I have an ASP.NET application that uses a COM (locally) to do some number crunching. Everything works fine when the COM is installed on the same machine as the web application. In fact, the ASP.NET application uses a web service to access the COM. The web service is also on the same machine.

Now, for performance reasons, we have decided to distribute the COM to several machines on the network so that we can have some distributed computing. I am not the one who is responsible for the COM development. For testing purposes, we have installed the COM on a remote machine and have created a .NET assembly that will interact with it.

First, I tried the concept using a console application. I reference the assembly, instantiate the class and perform the calculations. The COM works fine on the remote machine with no problems.

Now I am trying to make the ASP.NET application do the same thing as the console application but it's not working. I reference the assembly in my web service code but the call fails.
I know that the COM needs to be configured on the remote machine to allow access and execution. I have noticed that the account that should be used to contact the COM should be a domain account. When I run the console application from my machine, the Dllhost process on the remote machine shows well my username as owner.

I have suspected that because the web application runs with the ASPNET account, it wasn't allowed to run the COM on the remote machine. I have tried using impersonation to switch to my account inside the web service code. The impersonation works fine inside the code. When I debug, I can see that the Environment.UserName field goes from ASPNET to my username. However this doesn't solve the problem.

To check if the impersonation was working, I have tried calling my console application from inside the web service application using the Process class. When I go to the taks manager to see the processes list, I see that ASPNET is the owner of the console application. I have tried calling notepad also and I got the same thing.

So my first questions are:

Does impersonation work only inside the code? Why is my process running under ASPNET?

I have also read some things about delegation to allow a COM to be called across a network. I did some research about the matter and there were some things that needed to be set by the admin, to allow the impersonating account be used for delegation and the impersonated account also. We did all that but still it's not working. I'm sure I'm still missing a lot of stuff since I didn't find any article online that would explain the whole process.

My second question is:

Can anyone point to a URL or maybe explain to me how this delegation works? or maybe if someone has a way to launch a COM across the network, some tips, etc...


Thank you all for your efforts.

Talal