c# - WCF ResponseFormat JSON Returns Json in Fiddler, Xml in Chrome/Firefox! -


hi have wcf rest 4.0 project. reason have webservice should return json , if hit endpoint on fiddler thru firefox or chrome if type in address xml. whats going on???

thanks help! here's code.

web service in question:

  [operationcontract]   [webget(uritemplate = "",                             responseformat = webmessageformat.json,           requestformat = webmessageformat.json)]          public someobject [] getobjects()         {               ..... 

object code:

[datacontract] public class someobject {               [datamember]         public string date { get; private set; }          ....             public string site { get; private set; } 

if using .net 4.0 framework, solution: http://karnicki.eu/2011/02/rest-wcf-net-4-0-service-with-json-jsonp-for-jquery/

wcf has jsonp support out of box little configuration required.

basically need edit/add 2 config file entries, authenticationmode , standardendpoint, , voila, can view json response wcf service in browser.

edit: original link down - might help: http://blog.shutupandcode.net/?p=696


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -