How to get ArcGISDynamicMapServiceLayer object ?
I am getting the following error while creating ArcGISDynamicMapServiceLayer object in execute method of custom .net activity.
The calling thread must be STA, because many UI components require this?
protected override void Execute(CodeActivityContext context)
{
try
{
string strMapserviceUrl = string.Empty;
string strGdbVersion = string.Empty;
strMapserviceUrl = context.GetValue(this.MapServiceUrl);
if (strMapserviceUrl==string.Empty || strMapserviceUrl.Length==0)
{
throw new InvalidOperationException("Map Service Url is required.");
}
if (strMapserviceUrl.Contains("/MapServer"))
{
ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer objMapserviceLayer = new ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer();
objMapserviceLayer.Url = strMapserviceUrl;
strGdbVersion = objMapserviceLayer.GdbVersion;
}
else if (strMapserviceUrl.Contains("/FeatureServer"))
{
ESRI.ArcGIS.Client.FeatureLayer objFeatureLayer = new ESRI.ArcGIS.Client.FeatureLayer();
objFeatureLayer.Url = strMapserviceUrl;
strGdbVersion = objFeatureLayer.GdbVersion;
}
else
{
throw new InvalidOperationException("Invalid Map Service Url.");
}
GdbVersion.Set(context, strGdbVersion);
}
catch (System.Exception e)
{
Logger.SystemError("ERROR occurred in " + this.DisplayName + e.Message);
}
}
0
-
Now I can able to create ArcGISDynamicMapServiceLayer object. How can I read Gdb Version from from map service? 0 -
If there's a tag in the service definition, then you can get the json definition by making a webrequest to the page and parse it using the newtonsoft libs, but the builtin activity for getting layer definitions may be simpler for you. 0
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.
Kommentare
2 Kommentare