0
votes

I have two identical pieces of C# code that connects remotely to another server: one from console and the other from web application:

var mgr = ServerManager.OpenRemote(myServer) 

The console one works fine. The other however fails with the following exception:

System.UnAuthorizedAccessException with this com-message: {"Retrieving the COM class factory for remote component with CLSID {2B72133B-3F5B-4602-8952-803546CE3344} from machine failed due to the following error: 80070005 ."}

I have disabled the firewall on both servers and rebooted them.

Is there a way or a tool that will help me see how each connection played out like: what logins and access that both servers sent and received?

My attempt is not trapped in the IIS logs and event viewer.

I have tried to make fiddler listens, but it also didn't find anything.

2
is the difference the identity? In the case of the console, I think the identity is going to be you, probably Admin on both boxes. But in the case of the web code, the identity is probably weaker. What is the error message??BillH
The error is: System.UnAuthorizedAccessException with this com-message: {"Retrieving the COM class factory for remote component with CLSID {2B72133B-3F5B-4602-8952-803546CE3344} from machine <myserver> failed due to the following error: 80070005 <myserver>."} It is the ugliness of this message that made me ask this question.user1019042

2 Answers

0
votes

I would suggest that you use Process Monitor from SysInternals to watch what the web process is doing. The trick is going to be filtering the fire hose of info !! Btw, I suspect it is an Application Pool Identity or DCOM permission problem.

5
votes

The reason you're getting that exception is because the application pool identity doesn't have the enough rights. To use the Microsoft.Web.Administration managed API you need to be an administrator.

Also when you're using ServerManager.OpenRemote(), the account that your site runs under (be it the application pool identity or other account) would need to be a valid domain account with sufficient privileges.

Incidentally, the CLSID "2B72133B-3F5B-4602-8952-803546CE3344" is the class ID for the Microsoft.ApplicationHost.WritableAdminManager COM component that underpins the ServerManager managed API.