Select to view content in your preferred language

Can't get my data to show in Silverlight

1724
13
08-11-2010 05:25 PM
StephenLead
Honored Contributor
Hi everyone,

I need some help with a quick ArcGIS Server question. I'm running ArcGIS Server 10 on XP, with Visual Studio 2010 and Silverlight 4.

Everything is working correctly when using the sample ESRI servers, but I'm having problems with my Silverlight app seeing my ArcGIS Server services.

A simple example using a sample ESRI server is:

<UserControl x:Class="SilverlightApplication1.MainPage"
   xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:esri="http://schemas.esri.com/arcgis/client/2009">
    <Grid x:Name="LayoutRoot">

        <esri:Map x:Name="MyMap" >
            <esri:ArcGISTiledMapServiceLayer ID="StreetMapLayer"
           Url="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer"/>
        </esri:Map>

    </Grid>
</UserControl>

This opens correctly and shows a world map. If I replace the URL line with Url="http://qsq-brcon15-pc/ArcGIS/rest/services/Atlas_geology/MapServer"/> the app opens and shows the "powered by ESRI" logo, but no map content is shown. If I open the Rest Services page, I can see that this is a valid tiled service (full details below). If I choose "View In ArcGIS JavaScript" the dataset displays correctly.

The same thing happens with Feature and Dynamic layers. It appears that Silverlight is installed correctly, and ArcGIS Server is working correctly, but for some reason they're not talking to each other.

Do you have any suggestions for how I can debug this?

Thanks,
Steve

ArcGIS Services Directory       Home > Atlas_geology (MapServer)   Help | API Reference     Atlas_geology (MapServer)


  View In:    ArcMap   ArcGIS Explorer   ArcGIS JavaScript   Google Earth   ArcGIS.com Map   Bing Maps (terms of use)

View Footprint In:    Google Earth

Service Description:

Map Name: Layers

All Layers and Tables 

Layers:


Tables:

Description:

Copyright Text:

Spatial Reference: 3857

Single Fused Map Cache: true

Tile Info:



  • Height: 256

  • Width: 256

  • DPI: 96

  • Levels of Detail: (# Levels: 5)

  • Format: PNG8

  • Compression Quality: 0

  • Origin:

    • X: -20037508.342787
      Y: 20037508.342787

  • Spatial Reference: 3857

Intial Extent:

    XMin: 15508279.4278146
    YMin: -4706251.94265085
    XMax: 17290879.84873
    YMax: -3103956.25669766
    Spatial Reference: 3857
Full Extent:

    XMin: 15625616.5270059
    YMin: -4571758.85384883
    XMax: 17173350.0728764
    YMax: -3206780.82949168
    Spatial Reference: 3857
Units: esriMeters

Supported Image Format Types: PNG24,PNG,JPG,DIB,TIFF,EMF,PS,PDF,GIF,SVG,SVGZ,AI,BMP

Document Info:



  • Title: Geology fGDB

  • Author: slead

  • Comments:

  • Subject:

  • Category:

  • Keywords:

  • Credits:

Supported Interfaces:    REST   SOAP

Supported Operations:    Export Map   Identify   Find   Generate KML
0 Kudos
13 Replies
KatjaKrivoruchko
Occasional Contributor
Do you have clientaccesspolicy.xml or crossdomain.xml file on your web server? Please see the following for more info:

1. http://msdn.microsoft.com/en-us/library/cc197955%28VS.95%29.aspx.
2. http://blogs.esri.com/Dev/blogs/silverlightwpf/archive/2009/08/24/Troubleshooting-blank-layers.aspx
0 Kudos
JenniferNery
Esri Regular Contributor
To debug, you can use Fiddler and investigate the web requests and responses there, so you'll know at which step it failed to load/initialize your layer.

Jennifer
0 Kudos
StephenLead
Honored Contributor
Do you have clientaccesspolicy.xml or crossdomain.xml file on your web server?


Genius - that was the problem. Thanks very much for your help! That blog post is great.

Thanks also for the tips on Fiddler, which may prove useful in further debugging.
0 Kudos
StephenLead
Honored Contributor
Slightly unrelated question.... In the ESRI blog post there is some C# code:

private void layer_InitializationFailed(object sender, EventArgs e)
{
  Layer layer = sender as Layer;
  MessageBox.Show(string.Format("Layer '{0}' is currently unavailable. Error: {1}",
     layer.ID, layer.InitializationFailure.Message));
}

What's the VB.Net equivalent? I've tried the code below but this doesn't show an error message when I deliberately use a layer which doesn't exist:

Private Sub layer_InitializationFailed(ByVal sender As Object, ByVal e As EventArgs)
        Dim layer As Layer
        sender = layer
        MessageBox.Show(layer.ID, layer.InitializationFailure.Message, MessageBoxButton.OK)
End Sub

Thanks,
Steve
0 Kudos
JenniferNery
Esri Regular Contributor
I think you were close but you missed the TryCast.

Private Sub layer_InitializationFailed(sender As Object, e As EventArgs)
 Dim layer As Layer = TryCast(sender, Layer)
 MessageBox.Show(String.Format("Layer '{0}' is currently unavailable. Error: {1}", layer.ID, layer.InitializationFailure.Message))
End Sub


This is a useful link for C# to VB conversion: http://www.developerfusion.com/tools/convert/csharp-to-vb/

Jennifer
0 Kudos
StephenLead
Honored Contributor
awesome, thanks again.
0 Kudos
VickyP
by
Emerging Contributor
awesome, thanks again.


Hi Stevel,

  Did you get any success? I am also facing the same problem, I tried with SilverLight 4 + .NET framework 4.0 and ArcGIS Server 10, SilverLight 4 + .NET framework 3.5 and ArcGIS Server 10, still I am unable to see the map inside my SilverLight app. I tried clearing the REST cache, still no success, Now I will try with Fiddler.

   If you know the solution, then please share with me.
0 Kudos
StephenLead
Honored Contributor
Hi Varun,

I ended up using the JavaScript API, which suited my client's purposes better. So I haven't used the Silverlight API at all since I posted this question.

Sorry I can't help out.

Good luck,
Steve
0 Kudos
VickyP
by
Emerging Contributor
Hi Varun,

I ended up using the JavaScript API, which suited my client's purposes better. So I haven't used the Silverlight API at all since I posted this question.

Sorry I can't help out.

Good luck,
Steve


Hi Steve,

    Thanks for replying, I have solved the problem, you should have clientaccesspolicy.xml file in the webserver (iis) inside inetpub folder of the system in which ArcGIS SERVER is installed
0 Kudos