Paip. Solution to the remote server return error (417) Expectation failed
Author attilax, email: 1466519819@qq.com
To sum up the reasons:
The httpwebrequest control has a transparent process. It first queries the service provider for the existence of a URL without sending post content. If the server confirms that the URL is accessible, it sends a post, early Apache thought this was an error, while IIS
But can respond correctly
Remarks
When this attribute is set to true, client requests using the POST method should receive a 100-continue response from the server to indicate that the client should send the data to be published. This mechanism enables the client to report messages based on requests on the server
To avoid sending large amounts of data on the network
For example, assume that the system. net. sockets. servicepointmanager. expect100continue attribute is false. When a request is sent to the server, it includes data. If the server requires authentication after reading the Request Header
The client must use the correct authentication header to resend the data.
If this attribute is true, the request header is sent to the server. If the server does not reject the request, it will send 100-
Continue response, indicating that data can be transmitted. As in the previous example, if the server requires authentication, it will send a 401 response, and the client does not necessarily transmit data.
Solution:
-------------
Write. netProgramStart-upCodeOr in a file such as app. config.
Just add this sentence.
Servicepointmanager. expect100continue = false;
Refer:
-----------
C # solution to system. net. webexception remote server error (417) Expectation failed when simulating post data submission
Expect100continue_ _sina blog .htm