Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WCF Web Service error: "Service endpoint binding not using HTTP protocol"?

I've got a simple WCF service that has worked fine while I've been testing on my dev machine.

Now I've moved the web service to a web server, and I'm running the service (in debug mode) at http://mydomain.com:8005. Opening a web browser to that URL shows the expected service page, and if I put a breakpoint on the server inside the interface I'm calling, it hits the breakpoint and returns the expected data... but on the client side it comes back with the following error:

An error occurred while receiving the HTTP response to http://mydomain.com:8005/. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details.

More clues: the interface signature is:

IEnumerable<MyClass> GetThings(out string errMsg);

where MyClass is defined as Serializable, and the definitions are identical between client and server.

Any ideas what secret switches I need to flip?

like image 651
Shaul Behr Avatar asked Mar 15 '11 10:03

Shaul Behr


2 Answers

WCF also needs to have concrete classes to pass data around (since it all needs to be XML-serializable and must be capable of being expressed in XML schema - interfaces aren't well suited).

I believe it won't be able to pass back an IEnumerable<T> - try using a List<T> (or an T[] array) or a concrete type instead.

Any luck?

like image 124
marc_s Avatar answered Oct 15 '22 03:10

marc_s


I had the same problem because I was returning an insanely large amount of record from the server, i added the following line to my wcf config file and it worked.

<system.web>
    <httpRuntime maxRequestLength ="262144" executionTimeout="103600"/>
</system.web>
like image 22
zxnet Avatar answered Oct 15 '22 03:10

zxnet