Select to view content in your preferred language

Silverlight / ArcGIS / ArcObjects

1379
10
05-21-2010 01:14 AM
BrianBorg
Emerging Contributor
I have a number of web services published on a server that connects to the arcgis server and than consumed by the silverlight client. The webservices works fine on my development machine but when I publish them on the server, a connection with the arcgis server is never established. When I check the isconnected parameter of the AGSServerConnection class it gives me always false;
0 Kudos
10 Replies
sw1
by
Deactivated User
I was using Services to call ArcObjects such as Server connection and CreateFeatureWoekspace.  You have two options to get ArcGIS server connection, by using ESRI.ArcGIS.ADF.Connection.AGS.AGSServerConnection or ESRI.ArcGIS.Server.GISServerConnection.  When connection established, you can create server context by using ServerObjectManager.  After server context is ready, you can enjoy ArcObjects.....  Once should know is to save the context to session variable so you do not have to recreate in next service if session still alive.  You need to following property for your services
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]

Once your own ArcGIS services are ready, you are ready request from silverlight.

Good luck!
0 Kudos
nicogis
MVP Frequent Contributor
can you paste part of code where you use AGSServerConnection ?
what's the your configuration arcgis server? Are SOM/SOC on web server?
0 Kudos
sw1
by
Deactivated User
I am sorry I post this under a wrong thread.
0 Kudos
JohannBorg
Deactivated User
I'm having a siomilar problem. My webservice is working perfect when testing it from localhost but when I try to connect to it from Silverlight I always get a problem connecting.
Here is my code, maybe someone can help.
// Connect to ArcGIS Server
ESRI.ArcGIS.ADF.Connection.AGS.AGSServerConnection agsServerConnection =
           new ESRI.ArcGIS.ADF.Connection.AGS.AGSServerConnection();
agsServerConnection.Host = ConfigurationSettings.AppSettings["serverName"];
agsServerConnection.Connect();


Any help appreciated
Thanks a lot.
0 Kudos
dotMorten_esri
Esri Notable Contributor
Do you have your clientaccesspolicy.xml in place on your server?
0 Kudos
BrianBorg
Emerging Contributor
yes we do have the file
0 Kudos
nicogis
MVP Frequent Contributor
does it run : agsServerConnection.Connect()?  -> agsconnection.IsConnected == true
0 Kudos
BrianBorg
Emerging Contributor
does it run : agsServerConnection.Connect()?  -> agsconnection.IsConnected == true


That is the problem, agsconnection.IsConnected is false. The issue is that the webservice runs in local host but when published over IIS it won't
0 Kudos
ScottFriedrich
Regular Contributor
That is the problem, agsconnection.IsConnected is false. The issue is that the webservice runs in local host but when published over IIS it won't


Couple things to try - I always pass an ESRI.ArcGIS.ADF.Identity when connecting to Arc GIS Server:

'Connect to Arc GIS Server
agsIdentity = New ESRI.ArcGIS.ADF.Identity("user", "password", "domain")
agsConnection = New ESRI.ArcGIS.ADF.Connection.AGS.AGSServerConnection("servername", agsIdentity)
agsConnection.Connect(True)

The boolean parameter for Connect will throw an throwExceptionOnUnauthorizedAccess exception if this is the case.

Hope this helps,

Scott
0 Kudos