Connect LinqPad to WCF webservice with ?wsdl URI query

I want to connect LinqPad to a WCF web service which exposes its WSDL information at a URI of the form I can successfully add this URI as a Visual Studio WCF web service reference, and it works with WcfTestClient also.

The actual endpoint of the service, when connecting to invoke methods, is

When I try to add the web service as a LinqPad connection, if I specify the web service's URI including the ?wsdl query, I get a LinqPad error message saying "ArgumentException: Expected an absolute, well formed http URL without a query or fragment. Parameter name: serviceRoot". If I leave out the ?wsdl query, I get a 400 Bad Request response instead.

(I get the same 400 Bad Request response when I try to create a Visual Studio web service reference, or add the service to WcfTestClient, without appending ?wsdl to the URI).

Is there anything I can change at the client end to get LinqPad to successfully connect to this web service? Or do I need to mess around with the configuration at the server end? I don't control the web services I'm trying to connect to, but I might be able to tweak some configuration files on the server if I must.


Check out the following:

It's a third-party LINQPad driver for SOAP-based web services.

It looks like I misinterpreted the scope of LINQPad's "Add connection" feature. It's for WCF Data Services only (which implement the OData specification), not for WCF web services in general. (The difference between WCF services in general and WCF Data Services specifically wasn't previously clear to me).

The services I'm trying to connect to are WCF web services, but aren't WCF Data Service web services. It turns out that the correct way for me to consume those web services from LINQPad is to generate a proxy class code & configuration file using svcutil.exe, which can then be compiled through VS or csc.exe, and the resulting assembly is then added as a standard assembly reference in LINQPad. The proxy classes can then be used in LINQPad the same way that they are used in Visual Studio.

This really depends on where your strengths are. It is not easy to judge based on the question as it only describes attempts at running automated tools. Questions at SO usually have a "what have I tried thus far" part. This is not only to encourage efforts prior to posting, but also to see what avenues could be suggested.

One big question here is if you know enough of (or are willing to read up on) the workings of the add service reference feature to reproduce it in code. Or if you can find an open source project with proper licensing to leverage it.

I would suggest that you look into writing LINQPad data extentions.

I'll offer an alternative answer which will help if you're targeting a service that uses authentication. In my case the service uses Windows Auth which the linqpad soap driver does not yet support. You'll be generating the client code using svcutil.exe, compiling it to an assembly, and then creating a Linqpad query to use it.

  1. Generate your service client & config file with svcutil.exe http://mylocalsite/myservice.svc - it should produce a myservice.cs file and output.config.

  2. Compile the client code into an assembly: csc myservice.cs /target:library. You should now have myservice.dll.

  3. Create your linqpad query and go into its properties (F4). In the App.config tab set the Custom Path to the your output.config file. Under Additional References, add a reference to myservice.dll.

Your query will be very simple, something like:

var client = new MyServiceClient("BasicHttpBinding_IMyService");

var result = client.DoTheThing();



LinqPad will likely prompt you to add a reference to System.Web.Services.

Need Your Help

Getting a Stream from a resource file / content

c# asynchronous microsoft-metro windows-runtime windows-store-apps

Is this the correct/only way of getting a Stream from a resource file?