This is a migrated thread and some comments may be shown as answers.

Can't find shape files on server

3 Answers 80 Views
Map
This is a migrated thread and some comments may be shown as answers.
Donna
Top achievements
Rank 1
Donna asked on 23 Feb 2011, 09:47 PM
I'm having a problem when I try to use my map project on a shared server.  When I run it locally on my machine the following code works fine.

private const string ShapeRelativeUriFormat = "DataSources/Geospatial/USA/{0}";
  
public MainPage()
{
     InitializeComponent();
     this.radMap.Provider = new OpenStreetMapProvider(MapMode.Aerial, true);
     this.radMap.InitializeCompleted += new EventHandler(radMap_InitializeCompleted);
}
  
private void radMap_InitializeCompleted(object sender, EventArgs e)
{
     if (!this.initialized)
     {
          this.initialized = true;
          this.SetupReaders(); 
     }
}
  
public void SetupReaders()
{
     this.informationLayer.Reader = new MapShapeReader();
     this.informationLayer.Reader.PreviewReadCompleted += new PreviewReadShapesCompletedEventHandler(Reader_PreviewReadCompleted);
     this.informationLayer.Reader.Source = new Uri(string.Format(ShapeRelativeUriFormat, "usa_states"), UriKind.Relative);
}
  
private void Reader_PreviewReadCompleted(object sender, PreviewReadShapesCompletedEventArgs eventArgs)
{
      if (((MapShapeReader)sender).Source.ToString().Contains("usa_states"))
     {    
          if (eventArgs.Items != null)
          {
                 ....some logic here
          
     }
}


 

For some reason though, when I run the same exact code on the server it comes back with null within eventArgs.Items.  Its as though it is not finding the files?  I did see that eventArgs is also returning this error:

 

 

The remote server returned an error: NotFound.
Stack Trace: 
at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)
at System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.Net.WebClient.GetWebResponse(WebRequest request, IAsyncResult result)
at System.Net.WebClient.OpenReadAsyncCallback(IAsyncResult result)

 

 

Any ideas on how I could resolve this issue?


 

 

 

 

3 Answers, 1 is accepted

Sort by
0
Andrey
Telerik team
answered on 25 Feb 2011, 01:40 PM
Hello Donna,

It is very complicated and it is hard to reproduce the problem using just a code snippet you sent.
Most often this problem occurs in published projects when MIME types for shape and dbf files are undefined on the web server. Please check that MIME types for using shape files are defined:
Extensions: .shp and .dbf
MIME type: application/octet-stream

Also I would recommend to check that the files are accessible via HTTP on the server. For example you can try to download them using your web browser.

Best wishes,
Andrey Murzov
the Telerik team

Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Donna
Top achievements
Rank 1
answered on 25 Feb 2011, 09:32 PM
I added the MIME types to the IIS as:

.shp    application/octet-stream
.dbf     application/octet-stream

Then I went to test to see if the files were accessible via http, and sure enough they aren't.  I couldn't open any of the .shp or .dbf files on the web browser.  Can you please tell me what I need to do to make these files accessible?
0
Donna
Top achievements
Rank 1
answered on 25 Feb 2011, 09:43 PM
OK nevermind.  I was able to finally get it to work by changing the Build Action for the .dbf and .shp files to Content.

Thanks for all your help.
Tags
Map
Asked by
Donna
Top achievements
Rank 1
Answers by
Andrey
Telerik team
Donna
Top achievements
Rank 1
Share this question
or