JSON endpoint with .NET RIA Domainservice
I have created a RIA-service and added a JSON endpoint following this tutorial开发者_StackOverflow社区: http://www.c-sharpcorner.com/UploadFile/pchandraker/1320/. When testing it in the browser, hitting
http://localhost:52878/Project-Web-DomainService.svc/json/GetProjects
returns nothing. When inspecting the request in Firebug, neither the response headers or body is set. Hitting an invalid url, such as http://localhost:52878/Project-Web-DomainService.svc/json/GetProjectsINVALID returns a 404, saying "Endpoint not found" as expected.
Do I need to add additional metadata or configuration settings to either DomainService.cs or Web.config to get the JSON output?
Decorate your GetProjects functions from DomainService with [QueryAttribute(HasSideEffects = true)] attribute.
Good luck.
精彩评论