This code works fine on a development box, but fails in a server environment:
GISServerConnection gisServerConnection = new GISServerConnection();
gisServerConnection.Connect("localhost");
The exception is this:
Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
at ESRI.ArcGIS.Server.IGISServerConnection.Connect(String machineName)
My best guess is that I need to add a user to the agsusers group. Our server (Server 2008 R2) uses IIS 7.5, so I tried adding the application pool identity ASP.NET v4.0 Classic to the group. This failed, so I tried adding IUSR to the group, which also failed.
What could I be doing wrong?