Select to view content in your preferred language

Replacing url from sample to my service url

931
6
01-17-2011 06:47 AM
JoannaLaroussi
Emerging Contributor
I replicated in the Silverlight an example ArcGIS Dynamic Layer from ArcGIS API for Microsoft Silverlight. It worked fine, but when I tried to change url of sample to url of my map service, it returned me a white page. I tried with a few map services with the same result. My server is running, I can see my map services in preview of ArcCatalog, but I cannot use it in Silverlight. The url I tried to use is http://myservername/ArcGIS/rest/services/mymapservicename/MapServer. I am running Silverlight on the same machine, where ArcGIS Server 10 is installed. Does somebody have any idea how to make it work?
0 Kudos
6 Replies
DominiqueBroux
Esri Frequent Contributor
What to you get if you request your map service URL in your browser?

You should get something like : http://services.arcgisonline.com/ArcGIS/rest/services/Demographics/USA_Median_Home_Value/MapServer
0 Kudos
DanielWalton
Frequent Contributor
If your services are on a different server than your Silverlight XAP, do you have a crossdomain.xml file at your server's root directory? E.g.:

http://services.arcgisonline.com/crossdomain.xml
0 Kudos
JoannaLaroussi
Emerging Contributor
Thank you for your response. I do see something similar like in your example, but still this url does not work inside Silverlight 😞

What to you get if you request your map service URL in your browser?

You should get something like : http://services.arcgisonline.com/ArcGIS/rest/services/Demographics/USA_Median_Home_Value/MapServer
0 Kudos
JoannaLaroussi
Emerging Contributor
Thanks for the answer! I am just starting with Silverlight and I am not sure I understood your answer. At first I am running Silverlight on the same machine, where I have installed ArcGIS server, which makes me think that my Silverlight XAP is on the same server. I tried to add suggested code inside XAML
<UserControl x:Class="simpleMap.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" Background="White" >

        <esri:Map x:Name="MyMap" >
            <esri:ArcGISDynamicMapServiceLayer ID="MyLayer"
                Url="http://myservername/ArcGIS/rest/myservicename/MapServer" />
        </esri:Map>
        <?xml version="1.0" ?>
        -
        <cross-domain-policy>
            <allow-access-from domain="*" />
            <site-control permitted-cross-domain-policies="all" />
            <allow-http-request-headers-from domain="*" headers="*" />
        </cross-domain-policy>
    </Grid>
</UserControl>

But I am doing something wrong or in the wrong place�?�



If your services are on a different server than your Silverlight XAP, do you have a crossdomain.xml file at your server's root directory? E.g.:

http://services.arcgisonline.com/crossdomain.xml
0 Kudos
JenniferNery
Esri Regular Contributor
0 Kudos
JoannaLaroussi
Emerging Contributor
Thanks! I will try to check everything.
[

QUOTE=jenniferdnery;69397]You can read this blog to troubleshoot your application: http://blogs.esri.com/Dev/blogs/silverlightwpf/archive/2009/08/24/Troubleshooting-blank-layers.aspx

This might help you get started too: http://help.arcgis.com/en/webapi/silverlight/help/index.html#/Getting_Started/016600000004000000/
0 Kudos