417 Expectation Failed error

This post has been republished via RSS; it originally appeared at: IIS Support Blog articles.

417 status code refers to an issue with the Expect header in the request. The server was probably not able to meet the requirement in this header (RFC7231).

Nedim_0-1621974218455.jpeg

Solution

Collect a Fiddler trace and analyze the header. Do due diligence like probing when the issue started occurring, what was changed before, does it work in another server, etc.

 

In my case, the issue was caused by a missing forward slash (“/”) at the end of the CorsOrigin parameter in appsettings.json. Adding this solved the issue.

 

Note: System.Net.HttpWebRequest automatically adds “Expect: 100-Continue”‘ to requests (Reference). You may try removing it explicitly to solve this issue:

System.Net.ServicePointManager.Expect100Continue = false;

 

You can also remove this header through web.config:

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

 

REMEMBER: these articles are REPUBLISHED. Your best bet to get a reply is to follow the link at the top of the post to the ORIGINAL post! BUT you're more than welcome to start discussions here:

This site uses Akismet to reduce spam. Learn how your comment data is processed.