I need to get rid of the Expect: 100-Continue
header in HTTP message, when communicating with WebService using WCF in Windows Store App.
I have found a lot of solutions, but none of them is possible in Windows 8:
ServicePoint.Expect100Continue = false;
doesn't exist in Store App any more (No SericePoint
or ServicePointManager
class),web.config
file, because it doesn't exist in Store App,HttpClient
, but I cannot access it, when using WCF,IClientMessageInspector
, but the default HTTP headers are being added later, in higher layers, so my changes will be ovverriden.Does anyone have any other ideas?
There are 2 ways to deal with this.
You can turn set expect100Continue="false" in you app.config or web.config, but this will be global. This could be an issue if some external services prefer to use the header expect100Continue. Here's how:
<system.net>
<settings>
<servicePointManager expect100Continue="false"/>
</settings>
</system.net>
Or you can do it in code for a specific endpoint as follows:
System.Net.ServicePoint servicePoint =
System.Net.ServicePointManager.FindServicePoint(myWcfService.Endpoint.Address.Uri);
servicePoint.Expect100Continue = false;
// now execute some service operation
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With