Today I did a little demo using the Search API on Twitter. Create a new project and write the following test code directly in the Page_Load of the test page.
protected void Page_Load(object sender, EventArgs e)
string urlPost = "http://search.twitter.com/search.json";
string postData = "q=twitterapi";
UTF8Encoding encoding = new UTF8Encoding();
byte byteData = encoding.GetBytes(postData);
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(urlPost);
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = byteData.Length;
Stream requestStream = request.GetRequestStream();
requestStream.Write(byteData, 0, byteData.Length);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream receiveStream = response.GetResponseStream();
StreamReader readStream = new StreamReader(receiveStream, Encoding.UTF8);
Response.Write("Response stream received.");
Unfortunately, The error “The remote Server has returned an Error: (417) taught failed” appeared.
At first, I thought it was the “great Firewall”, but it was still the same after connecting to THE VPN, so I went online to find a solution, and finally I found the reason.
“This error can be caused by a client network environment (Don’t Support “100 continue”). Add the following to the program’s configuration file and give it a try.” The original address: http://0e2.net/post/1184.html
<servicePointManager expect100Continue="false" />
Reproduced in: https://www.cnblogs.com/aimarAgt/archive/2011/08/17/2143177.html
- The remote server returned an error: notfound when Silverlight calls WCF service
- Failed: error connecting to db server: server returned error on SASL authentication step: Authentica
- Vscode remote connection server reports an error: could not establish connection to “XXXXXX” [resolved]
- Reason: error reading from remote server
- How to Fix SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed.
- (Windows+xrdp+ubuntu16.04) Remote server error: “password failed error-problem connecting”
- Vs_ Code remote SFTP connects to the server to modify the nginx configuration information and reports all configured authentication methods failed
- Navicat remote connection SQL Server 2014 express report 08001 error
- Sqlog connect to MySQL 8.0.24 remote server, error: 2058 solution
- Remote sshd prompt: server unexpectedly closed network connection
- The solution of PL / SQL can’t connect to the remote server after installing Oracle locally
- Distribution setup SQL Server Agent error: “RegCreateKeyEx() returned error 5, ‘Access is denied.’” …
- SQL server remote computer refused network connection, error: 1225, specific solution steps.
- Error: more than one row returned by a subquery used as an expression
- An authentication error occurred in the remote desktop connection
- E: sub process / usr / bin / dpkg returned an error code (2) solution under Ubuntu
- AH01909: localhost:443:0 server certificate does NOT include an ID which matches the server name
- error PRJ0019: A tool returned an error code from “Performing Post-Build Event…”
- E: Sub process / usr / bin / dpkg returned an error code (1) solution
- Dm7 Dameng database dmrman reports an error OS_ pipe2_ conn_ Server open failed solution