Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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 :)

share|improve this question
    
can you translate the error message to english? –  Kirk Kuykendall Apr 7 '11 at 21:08
1  
Object reference not set to an instance of an object. –  mwalker Apr 7 '11 at 21:43
    
Did you try running it on the server and connecting to localhost? –  Kirk Kuykendall Apr 8 '11 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. –  brenth Apr 11 '11 at 13:44

1 Answer 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.

share|improve this answer
    
thx for ur help but i thik that that user name is a member of the agsadmin –  hana hana Apr 11 '11 at 9:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.