I'm running a basic .net runtime 10.2.6 project. Here's the workflow...
visual studio 2013 > file > new > project > visual C# > windows desktop > ArcGIS Runtime 10.2.6 for .NET Application
In Visual Studio's output window, I'm seeing...
"Error while loading layer : Basemap - Layer could not be added to Map because layer initialization failed. See InnerException for more information."
I added the InnerException argument to debug statement...
Debug.WriteLine(string.Format("Error while loading layer : {0} - {1} - {2}", e.Layer.ID, e.LoadError.Message, e.LoadError.InnerException));
And it produces...
System.Net.Http.HttpRequestException: Proxy Authorization Required
at Esri.ArcGISRuntime.Layers.Layer.<InitializeAsync>b__3(Task`1 t)
at System.Threading.Tasks.ContinuationTaskFromResultTask`1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
By default, it uses this as the basemap.
"http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"
I have no problem accessing the map through my browser. This URL produces maps everytime, quickly...
"http://services.arcgisonline.com/arcgis/rest/services/World_Topo_Map/MapServer?f=jsapi"
Solved! Go to Solution.
Editing the machine.config in C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config fixes the issue.
<configuration>
...
place the following at the bottom ...
<system.net>
<defaultProxy useDefaultCredentials="true" enabled="true">
<proxy usesystemdefault="True"/>
</defaultProxy>
</system.net>
</configuration>
If there's anyway to avoid having to do this, please let me know...
I setup the same project on my home PC. I tried it on the host PC and on a VM guest. The VM guest has the same issue--missing base map. I turned off the windows firewall to no avail.
I do not get the "Proxy Authorization Required" error.
If I run fiddler, it shows the tiles being returned OK, they are just not displaying. This might be a different problem from my work PC, which oddly, turning on fiddler actually causes the app to work properly.
Editing the machine.config in C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config fixes the issue.
<configuration>
...
place the following at the bottom ...
<system.net>
<defaultProxy useDefaultCredentials="true" enabled="true">
<proxy usesystemdefault="True"/>
</defaultProxy>
</system.net>
</configuration>
If there's anyway to avoid having to do this, please let me know...
I added that code to the app.config in the visual studio project and that's the answer. 😃
Hi,
I marked this answered and thanks for sharing the solution.
Thanks... I too had same problem and got the solution.