Webapi wrote to a colleague with ajax call, you have configured cross-domain request later get no problems, post has been reported 405 errors, spent half a day is not resolved, then see a blogger's post on the Internet only know that the webapi default web.config configuration issues, reprint come to record it for use next time.
too much
<handlers>
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<remove name="OPTIONSVerbHandler" />
<remove name="TRACEVerbHandler" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
Such a configuration, leading to not work. He should be deleted, plus the following support cross-domain code
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Methods" value="POST,GET" />
<add name="Access-Control-Allow-Headers" value="x-requested-with,content-type,authorization,mypara,username" />
</customHeaders>
</httpProtocol>
</system.webServer>
Original Source: https://www.cnblogs.com/shenbin/p/5680976.html