I also had both OWIN and my WebAPI, which apparently needed CORS, which in turn generated the error 'Access-Control-Allow-Origin' header contains multiple values .
I ended up removing ALL the code that CORS included, and then added the following to the system.webServer node of my Web.Config:
<httpProtocol> <customHeaders> <add name="Access-Control-Allow-Origin" value="https://stethio.azurewebsites.net" /> <add name="Access-Control-Allow-Methods" value="GET, POST, OPTIONS, PUT, DELETE" /> <add name="Access-Control-Allow-Headers" value="Origin, X-Requested-With, Content-Type, Accept, Authorization" /> </customHeaders> </httpProtocol>
Fulfilling these CORS requirements for OWIN (allowing login) and WebAPI (allowing API calls), but created a new problem: during the preview of my API calls, the OPTIONS method could not be found. The fix for this was simple - I just needed to remove the following from handlers node my Web.Config:
<remove name="OPTIONSVerbHandler" />
Hope this helps someone.
Matt Cashatt Aug 05 '15 at 10:20 2015-08-05 22:20
source share