Issue in accessing WMS layers in ArcGIS API 3.1 for Silverlight

2686
2
06-18-2019 04:28 AM
VinayS
by
New Contributor
We have developed an ArcGIS based Web application using  .net Silverlight framework (version 5).
The application consumes various layers published in ArcGIS server and displays them on the map.
 
Technologies used to develop the web application :
.Net framework version – 4.0
Silverlight Version – 5.1.50901.0
ESRIArcGIS.Client – 3.0.0.146
ESRIArcGIS.Client.Toolkit - 3.0.0.146
 
Now we have a new requirement to consume WMS layers published in Geoserver and display the layers along with the ArcGIS layers in the same map.
To consume WMS layers, we tried to install ‘ESRI.ArcGIS.Client.Toolkit.DataSources’ plug in from Nuget Package Manager. It resulted in below errors.
 
1. Install-Package : Unable to find package 'ArcGISSilverlight-ToolkitDataSources'.
At line:1 char:16
+ Install-Package <<<<  ArcGISSilverlight-ToolkitDataSources
    + CategoryInfo          : NotSpecified: (:) [Install-Package], InvalidOperationException
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
 
2. Tried to run the command  ‘Install-Package ArcGISSilverlight-All -Version 3.3.0.33’
which was found in link given below
 
Install failed. Rolling back...
Install-Package : Could not install package 'ArcGISSilverlight-Core 3.3.0.33'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.0', but the package does not contain any assembly references or content files that are comp
atible with that framework. For more information, contact the package author.
At line:1 char:16
+ Install-Package <<<<  ArcGISSilverlight-All -Version 3.3.0.33
    + CategoryInfo          : NotSpecified: (:) [Install-Package], InvalidOperationException
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
 
 
3. Tried to add  ‘ESRI.ArcGIS.Client.Toolkit.DataSources’ which was found in a sample code in  Git Hub
Got following error.
Error    4    Assembly 'ESRI.ArcGIS.Client.Toolkit.DataSources, Version=10.2.5.0, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86' uses 'ESRI.ArcGIS.Client, Version=10.2.5.0, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86' which has a higher version than referenced assembly 'ESRI.ArcGIS.Client, Version=3.0.0.388, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86'    e:\New folder\arcgis-samples-silverlight-master\src\ArcGISSilverlightSDK\Bin\Debug\ESRI.ArcGIS.Client.Toolkit.DataSources.dll
 
 
As the above plug-in is not supporting, is there any other plug-in / version of the plug-in that supports WMS layers?
OR
Is there any alternate solution available to implement WMS layers with Silverlight in my web application?
0 Kudos
2 Replies
dotMorten_esri
Esri Frequent Contributor

I believe this is the nuget you'd need: https://www.nuget.org/packages/ArcGISSilverlight-ToolkitDataSources/
But the Silverlight API has been completely out of support for several years now and it's likely the developer tooling no longer works with this. (To be honest I'm a little surprised people are still building new functionality with Silverlight these days 🙂

0 Kudos
VinayS
by
New Contributor

Thanks for the reply. 

ToolkitDataSources issue is resolved. 

Now I am trying to add WMS layer published on GeoServer using the code given below

var wmsLayer = new WmsLayer()
{
   ID = "highways:sp_health_dh",  
   Url = "https://tnssdi.tn.gov.in/geoserver/wms",
   SkipGetCapabilities = false,
   Version = "1.1.1",
   Opacity = 0.7,
   DisplayName = "District Hospitals",
   Layers = new string[] { "highways:sp_health_dh" }
};
map.Layers.Add(wmsLayer);

When I try to run the application, received the following error.

Unhandled exception at line 159, column 14 in http://localhost:60414/epathaigis.aspx

0x800a139e - JavaScript runtime error: Unhandled Error in Silverlight Application

Code: 4004

Category: ManagedRuntimeError

Message: System.Security.SecurityException: A security exception occurred while trying to connect to the 'WMS' service. Make sure you have a cross domain policy file available at the root for your server that allows for requests from this application. If not, use a proxy page (handler) to broker communication. ---> System.Security.SecurityException ---> System.Security.SecurityException: Security error.

at System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)

at System.Net.Browser.BrowserHttpWebRequest.<>c__DisplayClassa.<EndGetResponse>b__9(Object sendState)

at System.Net.Browser.AsyncHelper.<>c__DisplayClass4.<BeginOnUI>b__0(Object sendState)

--- End of inner exception stack trace ---

at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)

at System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)

at System.Net.WebClient.GetWebResponse(WebRequest request, IAsyncResult result)

at System.Net.WebClient.DownloadBitsResponseCallback(IAsyncResult result)

--- End of inner exception stack trace ---

at ESRI.ArcGIS.Client.Layer.OnInitializationFailed(EventArgs e)

at ESRI.ArcGIS.Client.Layer.Initialize()

at ESRI.ArcGIS.Client.Toolkit.DataSources.WmsLayer.client_DownloadStringCompleted(Object sender, DownloadStringCompletedEventArgs e)

at System.Net.WebClient.OnDownloadStringCompleted(DownloadStringCompletedEventArgs e)

at System.Net.WebClient.DownloadStringOperationCompleted(Object arg)

To resolve the error, I added crossdomain.xml in the root folder where the layers are published. Still I am getting the same error.

How can I resolve the above issue?

0 Kudos