>From the doc on MSDN "Changing the value of this property does not affect existing ServicePoint objects. Only new ServicePoint objects created after the change are affected. "
Make sure the statement System.Net.ServicePointManager.Expect100Continue = false; is called in the service contrutor and you should be fine. On Dec 25, 2:21 pm, weiran <[email protected]> wrote: > Setting > > > System.Net.ServicePointManager.Expect100Continue = false; > > Doesn't work for me, I still get 417 errors? > > On Dec 24, 9:31 pm, PockeTwitDev <[email protected]> wrote: > > > > > After investigating further it appears this only occurs for .NET > > applications which post using form data instead of using URL > > parameters. Here's a sample: > > > HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); > > request.Credentials = new NetworkCredential(AccountInfo.UserName, > > AccountInfo.Password); > > request.PreAuthenticate = true; > > request.ContentType = "application/x-www-form-urlencoded"; > > request.Method = "POST"; > > request.Headers.Add("Authorization", "Basic " + Convert.ToBase64String > > (Encoding.ASCII.GetBytes(AccountInfo.UserName + ":" + > > AccountInfo.Password))); > > byte[] bytes = Encoding.UTF8.GetBytes(data); //Data is what's being > > posted > > request.ContentLength = bytes.Length; > > System.Net.ServicePointManager.Expect100Continue = false; //NEED > > THIS NOW TO FIX ERROR 417 > > using (Stream requestStream = request.GetRequestStream()) > > { > > requestStream.Write(bytes, 0, bytes.Length); > > requestStream.Flush();} > > > using (HttpWebResponse response = (HttpWebResponse)request.GetResponse > > ()) > > { > > using (StreamReader reader = new StreamReader > > (response.GetResponseStream())) > > { > > return reader.ReadToEnd(); > > } > > > } > > > I don't doubt that it's a bug in the development platforms, but even > > so it's a pretty common one. It doesn't appear to happen to those > > apps which just URLEncode the data and include it in the URL, but I > > don't think that's exactly proper specification either :) > > > On Dec 24, 1:57 pm, Tom Morris <[email protected]> wrote: > > > > On Dec 24, 4:31 am, JakeS <[email protected]> wrote: > > > > > Looks like twitter is updating something and their servers are > > > > returning error 417 for a lot of requests. I looked into it and found > > > > that .NET automatically includes an Expect header containing "100- > > > > continue" on every request unless you specifically tell it not to. > > > > > So for any .NET devs having trouble, you can set > > > > System.Net.ServicePointManager.Expect100Continue = false before making > > > > your request to get past this issue. > > > > A lot of libraries follow this behaviour. A Twitter app I wrote in PHP > > > a while back has been logging 417s most of today. I logged in and > > > added: > > > curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:')); > > > > Other libcurl-based libraries may be affected. There are plenty of > > > reports about 417 and Expect on the cURL website -http://curl.haxx.se/ > > > - and on the websites of particular language bindings. > > > > -- > > > Tom Morris (@tommorris) > > > <http://tommorris.org>- Hide quoted text - > > - Show quoted text -
