3

I would like connect to ArcGIS server, but I have an error message "la référence d'un objet n'est pas définie à une instance a une objet". I have many examples:

string serverName = "adresse";
string instance = "ArcGIS/services";
// Using the ADF Common API data source implementation of the ArcGIS Server Web Service API
 string serviceNameAndType = "nameservice/MapServer";
 ESRI.ArcGIS.ADF.ArcGISServer.MapServerProxy agsSoapMapServerProxy = new
ESRI.ArcGIS.ADF.ArcGISServer.MapServerProxy("http://" + serverName + "/" + instance + "/" + serviceNameAndType);

or

 ESRI.ArcGIS.ADF.Identity identity = new ESRI.ArcGIS.ADF.Identity("usernamer", "password", "domain");
 ESRI.ArcGIS.ADF.Connection.AGS.AGSServerConnection agsconnection;
agsconnection = new ESRI.ArcGIS.ADF.Connection.AGS.AGSServerConnection("nomserver", identity);
 agsconnection.Connect();
 IServerObjectManager SOM = agsconnection.ServerObjectManager;

or

string mapServiceUrl = "http://servername/ArcGIS/services/servicename/MapServer";
ESRI.ArcGIS.ADF.ArcGISServer.MapServerProxy mapServerProxy = new ESRI.ArcGIS.ADF.ArcGISServer.MapServerProxy(mapServiceUrl);

I hope that someone can help me :)

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Apr 7, 2011 at 20:35
4
  • can you translate the error message to english? Commented Apr 7, 2011 at 21:08
  • 1
    Object reference not set to an instance of an object. Commented Apr 7, 2011 at 21:43
  • Did you try running it on the server and connecting to localhost? Commented Apr 8, 2011 at 13:47
  • Can you tell us which lines are giving you the error? I use your second method all the time, but when I put any invalid strings in, I get different (descriptive) errors - but never an object reference error. Commented Apr 11, 2011 at 13:44

1 Answer 1

1

Your issue is most likely related to user permissions. There are several things you need to make sure in order to connect to ArcGIS Server:

  • The user name you are trying to use must be a member of the agsadmin group
  • If this is a desktop application, the user you are currently logged in as (if different from above user) must also be a member of agsadmin.
  • If this is a web application, the ArcGISWebServices user must be a member of agsadmin. In addition, the user the web application is running under (Vista, 7, and server 2003+ use NETWORK SERVICE) needs to be a member of agsadmin. Alternately, you can set up a new application pool, and set it to run under the user you are trying to connect as, making sure that user is a member of agsadmin.

The bottom two points are required because DCOM actually doesn't impersonate the user you supply, it still continues to use the user information of the underlying process. There is a somewhat convoluted method of properly impersonating a user for DCOM use, however I can't remember if I ever got it running properly.

answered Apr 8, 2011 at 13:12
1
  • thx for ur help but i thik that that user name is a member of the agsadmin Commented Apr 11, 2011 at 9:43

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.