Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WCF service connection with third party dll with IIS

Tags:

c#

wcf

I am working with Windows 7, VS2010, SqlServer 2008.

My application takes data form a third party dll (which takes data from another process that must be running in the background) and processes the data and send it over a WCF service to the front end.

The application is done and does what it supposed to do. Now when I want to distribute it and Run it in IIS. I am facing a strange problem. The application get the data from a dll when I run it in IIS it fails and gives an error while connecting to the dll.

Retrieving the COM class factory for component with CLSID {FCEC6861-5866-4F9E9A09-7CC868C30A8B} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).

After some research I found out going to component service and inside DCOM config I change the security of the dll to everyone. The error stopped.

But now I don't get the error but I don't get the data like when the software which provides the data is closed. But work ok with my ASP.net development server.

Also I found that when I run Visual Studio in administrator mode I must run the third party data software in administrative mode too.

The dll reference is not copied in bin folder automatically, it put in obj folder and I manually copied it but it does not work.

like image 738
Taufiq Abdur Rahman Avatar asked Oct 26 '11 06:10

Taufiq Abdur Rahman


1 Answers

What I think happens is that the COM component is running in the same context as the caller and it needs elevated permissions to perform its job.

So:

  • VS in admin mode, COM in admin mode, works because both are having system wide permissions to perform their work.
  • IIS running under app pool account (not sure which), COM will also be under that account, but it is not an administrator, so too low on permissions to do the work correctly.

My troubleshooting suggestion would be to have the IIS application pool that your app is running under changed to be local admin. If that works OK, restore the access rights on your DCOM to the defaults (before changing to everyone) and try again. You might also try to run the app pool under the local system account to see what happens. If that still works, you have confirmed this behavior to be the problem.

like image 108
kroonwijk Avatar answered Oct 16 '22 13:10

kroonwijk