LINQPad via MVC4 WebApi

I have prepared the code that creates the collection. I would like to use this collection in LINQPad for various queries. Since LINQPad allows OData WCF, I thought MVC4 WebApi was perfect for this.

Unfortunately, I was not able to complete this work even with the WebApi template project. When I try to add a service to LINQPad, I get: "The data at the root level is invalid. Line 1, position 1. I think the problem is that LINQPad does not use content negotiation and it expects xml, but WebApi returns json.

Unfortunatelly Fiddler was unable to track requests.

Does anyone know how to fix this?

+6
source share
2 answers

LinqPad does not by default have REST drivers for requesting a web API service. See: http://forum.linqpad.net/discussion/199/linqpad-error-when-access-odata-using-webapi

However, the following Filip W. blog post talks about this issue and how you can create a custom ControllerResolver that overrides the default recognizer and allows you to run the web API from LinqPad. Take a look:

ASP.NET Web API Hosting in LinqPad

This post follows the same question: Using WebAPI in LINQPad?

+1
source

why don't you just use the HttpClient class? Httpclient

0
source

Source: https://habr.com/ru/post/912202/


All Articles