Unhandled Error in Silverlight Application Code: 4004

6420
12
09-08-2010 11:29 AM
by Anonymous User
Not applicable
Unhandled Error in Silverlight Application Code: 4004

I am trying to follow the tutorial for my first SilverLight application - http://resources.esri.com/help/9.3/arcgisserver/apis/silverlight/help/index.html

I can hit the ESRI server with Silverlight fine.  But when I change it to my server I get the error - Unhandled Error in Silverlight Application Code: 4004

I have the clientaccesspolicy.xml and can browse to it.  I can see the listed services in the browser (Http://localhost/arcgis/rest/services)

There is nothing special going on here.  All I have is a map control ---

<UserControl x:Class="SilverlightApplication3.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:esri="clr-namespace:ESRI.ArcGIS.Client;assembly=ESRI.ArcGIS.Client"     
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">
    <Grid x:Name="LayoutRoot" Background="White">

        <esri:Map x:Name="MyMap" DataContext="{Binding}">
            <esri:ArcGISTiledMapServiceLayer ID="Parcel"
           Url="http://localhost/ArcGIS/services/Test1/MapServer"/>
        </esri:Map>


    </Grid>
</UserControl>

--

I can add the service to an ArcMap project.

Any ideas would be welcome.
0 Kudos
12 Replies
TerryGiles
Occasional Contributor III
Looks like you're not hitting the REST endpoint of the map service. Change

<esri:ArcGISTiledMapServiceLayer ID="Parcel"
Url="http://localhost/ArcGIS/services/Test1/MapServer"/>

to

<esri:ArcGISTiledMapServiceLayer ID="Parcel"
Url="http://localhost/ArcGIS/rest/services/Test1/MapServer"/>
0 Kudos
by Anonymous User
Not applicable
Thanks.  That did it.  I am getting an unauthorized access error now, but I suspect that is in my server settings.
0 Kudos
TerryGiles
Occasional Contributor III
What's in your clientaccesspolicy.xml on the server?
0 Kudos
by Anonymous User
Not applicable
clientaccesspolicy.xml -

  <?xml version="1.0" encoding="utf-8" ?>
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-request-headers="*">
  <domain uri="*" />
  <domain uri="http://*" />
  </allow-from>
<grant-to>
  <resource path="/" include-subpaths="true" />
  </grant-to>
  </policy>
  </cross-domain-access>
  </access-policy>

Looks like it's wide open to me.  I am and administrator on the machine with server on it.  The data is on another server.  I am also a member of the agsusers and agsadmin groups.

I notice in the service manager "Security for GIS Services is:  Enabled"  and it states that it cannot be disabled using Manager.  Would this be something I have to do in IIS?

Thanks, still having problems with "Error: Unhandled Error in Silverlight Application Code: 4004 Unauthorized access"
0 Kudos
TerryGiles
Occasional Contributor III
I think you're right - it's probably the security settings for ArcGIS Server.  I can't help much with that - I'm just starting to implement it myself.  At least in previous versions of AGServer once you enabled security you could not turn it off.  Make sure you're a member of a security group in Server - see the Internet Security Overview topic in Server Help.

Might also want to see this blog about working with secured services in Silverlight -

http://blogs.esri.com/Dev/blogs/silverlightwpf/archive/2010/02/15/How-to-use-secure-ArcGIS-Server-se...

I'll be muddling through this myself in the next couple of weeks!
0 Kudos
by Anonymous User
Not applicable
I'll keep poking around and will post if I figure it out.  Soon I will have to switch gears and work on something else.  Additional comments are welcome and I will watch this thread.

Thanks.
0 Kudos
TerryGiles
Occasional Contributor III
This thread got me motivated to get this done on my server.  Here's what I did -

We're using Windows users/roles for the security store in server Manager

I have services that need to be available to everyone in our organization at the main root level of the server.  For map services that need to be secured and accessible only by certain domain users I created sub folder (called project1) and created their services in there.

On the server I created a local group and added the users (and myself) who need the secured data to it.  I called it agserver_project1_security.

Then in Server Manager, I set the root folder of the server to be accessible to all domain users (in our domain its a group called AllUsers)
On the sub folder that contains the services I really want to limit access to, I added the local user group agserver_project1_security.  I also removed the Domain Users group - assuming it was applied when I set it to the parent folder..there was some warning about child folders and services that I hit OK on before reading...

Enabled security in Server Manager.

Stopped and restarted the SOM and tried to view the services at the root and for the project1 folder -

http://localhost/arcgis/rest/services - got an access denied error!
http://localhost/arcgis/rest/services/project1 - got an acess denied error!

Aw nuts.  I went back and read some of the ESRI doc again and came across one little thing I missed - Turn off Anonymous Access on ArcGIS/rest and ArcGIS/Services in IIS (see step 7 in the Internet security checklist.

Turned off anon access and turned on Integrated Windows Auth.  Tried viewing the services folder again and it worked.

Added a service from the project1 folder to silverlight map app and can view it.

As a double check, took myself out of the ags_project1_security group and now cannot access the project1 folder or the map service in silverlight.

Hope this helps, Terry
0 Kudos
by Anonymous User
Not applicable
Thanks Terry,

Right now, I want things wide open.  I am going to try to create another Host machine.  The machine where the data is actually located.  See what that does.

It's pretty weird, I've been having to re-run post installation just about every day.
0 Kudos
by Anonymous User
Not applicable
OK, two hours on the phone with ESRI and it's fixed - They tried a lot, but this is what I think was up.

1- I had enabled Security for GIS services in manager.  This is now disabled.  Not really sure how they did that.

2 - Turn off Integrated Windows authentication in IIS for ArcGIS and ArcGIS/Rest and ArcGIS/services.

That's it.  Thanks for the suggestions folks.
0 Kudos