When I run my sample WCF application I get the following error in WCF Test Client window
This operation is not supported in the wcf test client because it uses type system.io.stream
I have ping method that uses Stream in my service implementation.
public string Ping(Stream input)
{
var streamReader = new StreamReader(input);
string streamString = streamReader.ReadToEnd();
streamReader.Close();
NameValueCollection nvc = HttpUtility.ParseQueryString(streamString);
return string.IsNullOrEmpty(nvc["message"])
? "The 'message' key value pair was not received."
: nvc["message"];
}
in my web.config file I added
<basicHttpBinding>
<binding name="HttpStreaming" maxReceivedMessageSize="67108864" transferMode="Streamed" > </binding>
</basicHttpBinding>
To allow streaming. now when I run the application I get the above error. I googled and researched quite a bit. I used fiddler to track down the error and it was http error 415 which is confirming the above error coming from WCF Test Client.
Update: Here is my service contract
[ServiceContract]
public interface IService1
{
[OperationContract]
[WebInvoke(UriTemplate = "ping")]
string Ping(Stream input);
}
Curl command I used
curl -x 127.0.0.1:8888 http://localhost:8000/Service1.svc/ping -d message=pong
Notice -x 127.0.0.1:8888 is for fiddler to capture the traffic
Here is fiddler result
# Result Protocol Host URL Body Caching Content-Type Process Comments Custom
1 415 HTTP localhost:8000 /Service1.svc/ping 0 private curl:7440