请参考我之前的问题在下面给出的链接。
//www.gobook3.com/message/858968-re-issue-in-accessing-wms-layers-in-arcgis-api-31-for-silv..。
我试图添加WMS层发布在GeoServer使用下面给出的代码
var wmsLayer = new wmsLayer ()
{
ID = "高速公路:sp_health_dh",
Url = "https://tnssdi.tn.gov.in/geoserver/wms",
SkipGetCapabilities = false,
版本= "1.1.1",
不透明度= 0.7,
DisplayName = "地区医院",
Layers = new string[]{"高速公路:sp_health_dh"}
};
map.Layers.Add (wmsLayer);
当我试图运行应用程序时,收到以下错误。
中的第159行第14列未处理异常http://localhost:60414/epathaigis.aspx
0x800a139e JavaScript运行时错误:在Silverlight应用程序中未处理的错误
代码:4004
类别:ManagedRuntimeError
消息:System.Security.SecurityException:试图连接到“WMS”服务时发生安全异常。确保在服务器的根目录下有一个跨域策略文件,该文件允许来自此应用程序的请求。如果不是,使用代理页面(处理程序)来代理通信。——> System.Security.SecurityException:安全错误。
在System.Net.Browser.BrowserHttpWebRequest。InternalEndGetResponse (IAsyncResult asyncResult)
在System.Net.Browser.BrowserHttpWebRequest。< > c__DisplayClassa。< EndGetResponse > b__9 sendState(对象)
在System.Net.Browser.AsyncHelper。< > c__DisplayClass4。< BeginOnUI > b__0 sendState(对象)
——内部异常堆栈跟踪结束——
在System.Net.Browser.AsyncHelper。BeginOnUI(SendOrPostCallback beginMethod,对象状态)
在System.Net.Browser.BrowserHttpWebRequest。EndGetResponse (IAsyncResult asyncResult)
在System.Net.WebClient。GetWebResponse(WebRequest请求,IAsyncResult结果)
在System.Net.WebClient。DownloadBitsResponseCallback (IAsyncResult结果)
——内部异常堆栈跟踪结束——
在ESRI.ArcGIS.Client.Layer。OnInitializationFailed (EventArgs e)
在ESRI.ArcGIS.Client.Layer.Initialize ()
在ESRI.ArcGIS.Client.Toolkit.DataSources.WmsLayer。client_DownloadStringCompleted(对象发送者,DownloadStringCompletedEventArgs e)
在System.Net.WebClient。OnDownloadStringCompleted (DownloadStringCompletedEventArgs e)
在System.Net.WebClient。DownloadStringOperationCompleted arg(对象)
为了解决这个错误,我在发布图层的根文件夹中添加了crossdomain.xml。我仍然得到相同的错误。
如何解决上述问题?