Select to view content in your preferred language

Getting "Error while loading layer : Basemap..." in basic .net runtime project

4494
5
Jump to solution
01-05-2016 01:57 PM
SeanNakasone
Emerging Contributor

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"

0 Kudos
1 Solution

Accepted Solutions
SeanNakasone1
Deactivated User

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...

View solution in original post

0 Kudos
5 Replies
SeanNakasone
Emerging Contributor

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.

0 Kudos
SeanNakasone1
Deactivated User

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...

0 Kudos
SeanNakasone1
Deactivated User

I added that code to the app.config in the visual studio project and that's the answer. 😃

0 Kudos
AnttiKajanus1
Deactivated User

Hi,

I marked this answered and thanks for sharing the solution.

0 Kudos
PremaRajanna
Deactivated User

Thanks... I too had same problem and got the solution.

0 Kudos