1. 程式人生 > >遠端伺服器返回錯誤:Expectation Failed

遠端伺服器返回錯誤:Expectation Failed

這個異常源自HTTP1.1協議的一個規範: 100(Continue) 100(Continue)狀態程式碼的解釋
允許客戶端發request訊息body之前先用request header試探一下server,看server要不要接收request body,再決定要不要發request body。 客戶端在Request頭部中包含 Expect:100-continue Server接到後  如果回100(continue)這個狀態程式碼,客戶端就繼續發request body。 這個設定是Http1.1才有,可以再配置檔案加一下節點解決

<configuration>
  <system.net>
    <settings>
      <servicePointManager expect100Continue="false" />
    </settings>
  </system.net>
</configuration>