I have a simple AGS map service. I accidentally specified an invalid SRID explicitly in my Silverlight XAML:
<esri:Map x:Name="Map" IsLogoVisible="False">
<esri:Map.Extent>
<esri:Envelope XMin="526801.81" YMin="489775.0655" XMax="593105.41" YMax="523904.2045">
<esri:Envelope.SpatialReference>
<esri:SpatialReference WKID="3807" />
</esri:Envelope.SpatialReference>
</esri:Envelope>
</esri:Map.Extent>
<esri:Map.Layers>
<esri:ArcGISDynamicMapServiceLayer x:Name="MyLayer" ID="MyService" Url="http://localhost/ArcGIS/rest/services/MyService/MapServer" Initialized="MyLayer_Initialized" InitializationFailed="Layer_InitializationFailed" />
</esri:Map.Layers>
</esri:Map>
This results in a RESTful request that looks like this:
http://localhost/ArcGIS/rest/services/MyService/MapServer/export?bbox=526801.8125,479254.134305427,593105.4375,534425.146944573&size=1078,897&format=png24&transparent=true&layers=show:0,1&f=image&imageSR=3807&bboxSR=3807
This request fails with the following IIS error:
Error Summary
HTTP Error 500.0 - Internal Server Error
The page cannot be displayed because an internal server error has occurred.
Detailed Error Information
Module ESRI.RestModule-Integrated
Notification ResolveRequestCache
Handler StaticFile
Error Code 0x00000000
If I replace the invalid SRID, everything works fine.
Is there any way to get the Silverlight API to report exceptions like this? As it is I have to use Fiddler to find it.
Best Answer
It doesn't look like Esri supports this spatial ref:Update: this seems to work:
I'm also interested in ways to trap a 500 error in silverlight.
Update: If we were working with WCF directly, it appears that Microsoft provides a way to catch this. However, since it is Esri's Map control making the calls, it seems like they would need to catch it. I don't see something for this in the Map control's list of events. Maybe the Map needs to expose something similar to Layer.InitializationFailed, that would let us catch these types of http errors without relying on Fiddler.