Select to view content in your preferred language

not able to access dynamic map service

1145
8
11-14-2011 10:01 PM
DeepikaJain
Occasional Contributor
Hey

This might be a simple stuck but i am not able to resolve it. I have published a simple map service and is trying to access the map service through silverlight application. I am working on visual studio 2008 sp1 with silver light api 1.2 and silvelight kit installed.\

I haev also added clientaccesspolicy.xml and crossdomain xxml file to wwwroot directory.

here is the piece of my code:
<UserControl x:Class="SilverlightApplication1.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:theme=
"clr-namespace:System.Windows.Controls.Theming;assembly=System.Windows.Controls.Theming.BureauBlue"
xmlns:esri="clr-namespace:ESRI.ArcGIS.Client;assembly=ESRI.ArcGIS.Client"
xmlns:esriSymbols="clr-namespace:ESRI.ArcGIS.Client.Symbols;assembly=ESRI.ArcGIS.Client"
xmlns:esriConverters="clr-namespace:ESRI.ArcGIS.Client.ValueConverters;assembly=ESRI.ArcGIS.Client"
xmlns:esriToolkit="clr-namespace:ESRI.ArcGIS.Client.Toolkit;assembly=ESRI.ArcGIS.Client.Toolkit"

    mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480">
   
  <Grid x:Name="LayoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="400"/>
        </Grid.RowDefinitions>

       
           
            <esri:Map x:Name="MyMap">
            <esri:Map.Layers>
                <esri:ArcGISDynamicMapServiceLayer ID=" map1" Url="https://localhost/ArcGIS/rest/services/forS/MapServer" />
                <!--<esri:ArcGISTiledMapServiceLayer ID="StreetMapLayer"  Opacity="1"
           Url="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer" />-->

            </esri:Map.Layers>
        </esri:Map>

    </Grid>
</UserControl>

If I try to access online layer, it works fine. but it does access the service hosted in my machine.

It throws the error : "A security exception occured while trying to access REST Endpoint".

Please help.

Thanks
Deepika
0 Kudos
8 Replies
DominiqueBroux
Esri Frequent Contributor
You run into a cross sheme issue.

Please look at this blog .
0 Kudos
DeepikaJain
Occasional Contributor
Dear Domonique

Thanks for helping me out.

I am not able to access the service even if i put http://..... url.

I have placed both the xmls in the wwwroot directory.

Deepika
0 Kudos
DominiqueBroux
Esri Frequent Contributor
Check that:
   - your 'ClientAccessPolicy.xml' file is on the root of your services Web server (i.e. not your web application server if not the same).
   - this file contains this line:  domain uri="http://*"

If this is not working, try using fiddler to look at the requests sent to the servers. This might give a clue.
0 Kudos
DeepikaJain
Occasional Contributor
Dear Dominique

What is meant by root of Services web server? The Service is using IIS as the web server.

yes, the xml does have that line.

Thanks
Deepika
0 Kudos
DominiqueBroux
Esri Frequent Contributor
By 'root', I meant that you should get your policy file by a request like : https://localhost/ClientAccessPolicy.xml
(by supposing 'localhost' is still your map server).
0 Kudos
DeepikaJain
Occasional Contributor
Yes, I do get the policy file by that url...but i still get the same error.
0 Kudos
DeepikaJain
Occasional Contributor
Is there anyone else..who is facing the error
0 Kudos
JenniferNery
Esri Regular Contributor
Are you able to access the REST endpoint from your web browser? This blog post might help: http://blogs.esri.com/Dev/blogs/silverlightwpf/archive/2009/08/24/Troubleshooting-blank-layers.aspx
0 Kudos