A security exception occurred while trying to connect to the 'WMS' service

2693
0
07-11-2019 02:22 AM
VinayS
by
New Contributor

Please refer my previous question in the link given below.

https://community.esri.com/message/858968-re-issue-in-accessing-wms-layers-in-arcgis-api-31-for-silv...

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
0 Replies