Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm having trouble creating an OpenLayers Vector layer with GeoJSON data in an MVC 4 application.

The GET request for my json file always comes back with a 404.3 error - page cannot be served because of the extension configuration.

I've followed every OpenLayers example creating the GeoJSON layer just as they have but I can't get mine to display. I've followed the steps in this post Trouble Displaying GeoJSON file in OpenLayers and everything besides the GeoJSON layer works great.

So in my OpenLayers.aspx page I have the following code to initialize my vector layer.

var vector = new OpenLayers.Layer.Vector("GeoJSON", {
            projection: new OpenLayers.Projection("EPSG:900913"),
            strategies: [new OpenLayers.Strategy.Fixed()],
            protocol: new OpenLayers.Protocol.HTTP({
                url: "<%:this.Url.Content("~/Content/Delta_Parcels_2008.json") %>",
                format: new OpenLayers.Format.GeoJSON({
                    internalProjection: new OpenLayers.Projection("EPSG:900913"),
                    externalProjection: new OpenLayers.Projection("EPSG:4326")
            styleMap: vector_style_map

any suggestions would be much appreciated. thanks.

share|improve this question
Can you get more details about the 404 error? – steko Mar 18 '13 at 23:14
up vote 0 down vote accepted

IIS and IIS Express do not have the mime type for "json" by default. You need to add the mime type to your web server so it knows to server the JSON file. If you are using the built in web server (Cassini) then it does not have support and you will need to switch.

Here is how you do it:

IIS 7:

IIS Express:

You can also do it in your web.config:

share|improve this answer
excellent, that did the trick. No longer getting the 404 error, now to just figure out why it isn't displaying I'm guessing the projection is off. Thanks again. – user501211 Mar 18 '13 at 20:06

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.