Does System.Net.Http.HttpClient support sending a GET request with an
entity body?
I'm developing a Windows Phone 8 app that consumes a web service. This
particular web service requires a GET request with an entity body.
I'm using the System.Net.Http.HttpClient to send this request, which I've
successfully used to send various other web requests (GETs, POSTs, and
PUTs). This is the first GET request that includes a payload and therefore
includes a Content-Type and Content-Length header.
The request fails with an exception like the following:
'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight
AppDomain): Loaded
'C:\windows\system32\en-US\mscorlib.debug.resources.dll'. Module was built
without symbols. An exception of type
'System.Net.ProtocolViolationException' occurred in System.Windows.ni.dll
and wasn't handled before a managed/native boundary A first chance
exception of type 'System.Net.ProtocolViolationException' occurred in
mscorlib.ni.dll An exception of type
'System.Net.ProtocolViolationException' occurred in mscorlib.ni.dll and
wasn't handled before a managed/native boundary
Including a payload with a GET request is a bit unusual although according
to my research, not expressly forbidden by the RFCs.
I don't have the option of changing the web service. Does
System.Net.Http.HttpClient outright not allow a GET with an entity body?
If not, are there any work-arounds?
Thank you.
No comments:
Post a Comment