SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. 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

In a standard team site, I have a document library that host a static website with html files as well json files loaded asynchronously with javascript.

This was working well in SharePoint 2007. unfortunately, since we migrated to SharePoint 2010, a http GET request on a JSON file fails with:

An error occured while processing resource /foo/bar.json. The page must have a <%@ webservice class="MyNamespace.MyClass" ... %> directive.

This just doesn't make sense. I want the json file to be served as a plain-text resource.

How can I fix this error?

share|improve this question
    
I translated the error message from French to English myself. Please edit the question if you know how the genuine message. – rds Feb 11 '13 at 10:32
    
I am facing the same problem, which web.config file I should modify? I just want to modify only for one site not for the whole server. Thanks in advance. Raghu – Raghu Jul 4 '13 at 6:56
up vote 1 down vote accepted

It's not a good idea to disable the handler. In SharePoint 2013, some services like Managed Metada or Excel Services are relying on it and won't work anymore without it.

For example, when you open an Excel file in SharePoint using Excel services, the page calls some .json files when loading : [myserver]/_vti_bin/DynamicGridContent.json/GetRangeContent

Or when you want to select a value in a managed metadata field : [myserver]/_vti_bin/TaxonomyInternalService.json/ValidateTerms

You can find the complete list of JSON used by SharePoint in the ISAPI folder : enter image description here

So, instead of disabling the handler, you can filter the path to apply the handler only on files from the /_vti_bin/ folder :

<add name="JSONHandlerFactory" allowPathInfo="true" path="/_vti_bin/*.json" verb="*" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" resourceType="Unspecified" preCondition="integratedMode" />

And so you will be able to store and call your own .json in a document library without impacting other features.

share|improve this answer
    
Note that I didn't recommend to disable the handler. Using a path filter sounds like a good workaround. – rds Feb 20 at 21:03

The default web.config contains in <system.webServer><handlers> this handler:

<add name="JSONHandlerFactory" path="*.json" verb="*" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" resourceType="Unspecified" preCondition="integratedMode" />

As such, SharePoint thinks that URLs ending with .json are backed up by a web service.

I don't know whether native fonctionnalities rely on such services, hence I don't think it's a good idea to disable this handler. Apparently, Microsoft didn't think that the storage of JSON files in a document library is a valid use case.

share|improve this answer
    
Already added this string in web.config still getting this error. – DOM Feb 3 at 12:14

Your Answer

 
discard

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.