I have prepared some code that builds a collection. I would like to use this collection in LINQPad for various queries. As LINQPad allows WCF OData I thought that MVC4 WebApi would be perfect for this.
Unfortunatelly I wasn't able to make this work even with the template WebApi project. When I try to add service to LINQPad I get "Data at the root level is invalid. Line 1, position 1. I think the problem is that LINQPad doesn't use content negotiation and it is expecting xml but WebApi returns json.
Unfortunatelly Fiddler wasn't able to monitor the requests.
Anyone know how to fix this?
LinqPad does not have the REST drivers by default to query a Web API service. See: http://forum.linqpad.net/discussion/199/linqpad-error-when-access-odata-using-webapi
However, the following blog post by Filip W. speaks to this issue and how you can create a custom ControllerResolver
that overrides the default resolver and allows running Web API from LinqPad. Have a look:
Hosting ASP.NET Web API in LinqPad
This post follows the same question: Using WebAPI in LINQPad?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With