Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LINQPad over MVC4 WebApi

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?

like image 589
bodziec Avatar asked Apr 02 '12 06:04

bodziec


1 Answers

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?

like image 127
atconway Avatar answered Oct 03 '22 14:10

atconway