Developer Forum »
Error in oData-query after last update
62 posts
Hi! I just upgraded to Webnodes version 1514 (with oData 3.0), and then I get an error message in my oData-code.  What do I need to do in Webnodes in order to fix this? The type 'WAF.Service.Data', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found.
181 posts

Hi!

Do you have some more information? Does it affect all OData code, or is it just some code that fails? What kind of site is it?

62 posts

It is a standard Web-form project, with a simple oData example. In my javascript code I call 

$.getJSON(connectionstring, null, function (data) { .... }

.. and the connectionstring looks like this: http://www.XXXX.no/odata/SystemUsers?$format=JSON&$select=Name,Id,UserName,Email

and then I get this error mesage.

When I try to do a full rebuild, I get compilation errors in App_Code/WAF/OdataServices, so I haven't completed the rebuild.

181 posts

Hi!

I downloaded the site, and did a full rebuild to regenerate the OData data model. I didn't get any compilation errors in my installation of the site, and the OData endpoint worked fine after the rebuild.

Could you take a screenshot of the compilation errors you get when you try to do a full rebuild? 

62 posts

Hi!

I did a full rebuild again, but this time without any errors in the App-code-files. I haven't changed anything since last time I tried. So now the rebuild was successful, but the oData-query returns:

 

Failed to load resource: the server responded with a status of 415 (Unsupported Media Type)

 

____________

This XML file does not appear to have any style information associated with it. The document tree is shown below. <error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"> <code/> <message xml:lang="nb-NO">Unsupported media type requested.</message> </error>
58 posts

Set the accept-header to "application/json;odata=verbose" and it will work. No need for the format parameter.

181 posts

As Lars Erik is saying, you can set the header. The reason for this is that OData v3 (or more correctly WCF Data Services 5.0) removed support for $format=json in the querystring since they were working on a new more compact json format that was released after 5.0, that do support $format=json in the querystring, and they wanted to avoid compatibility issues.

The latest build of Webnodes uses 5.0 of WCF DS. We have a new version in testing that uses 5.4, and that we've verified works with the site you're having the problem with, Helene.

Note that the new more compact json format in 5.4 might require some minor code changes. The alternative is to use the verbose header Lars Erik mentions to get exactly the same Json as in V2.

The new build using WCF DS 5.4 will be released later today.

62 posts

Thank you, both Vidar and Lars Erik!

I kept the existing code. In the loop 

 $.getJSON(connectionstring, null, function (data) {
        $.each(data.d, function (i, member) { ... }
      });

});

 

I just changed data.d to data.value and it worked perfectly again. 

1