I have configured Web.Config in web.Server element.
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="http://localhost:xxxxx" />
<add name="Access-Control-Allow-Headers" value="content-type" />
<add name="Access-Control-Allow-Methods" value="GET, POST, OPTIONS, PUT, DELETE" />
</customHeaders>
</httpProtocol>
When it comes GET Request all data are retrieved.
When I want to POST new element in request, I get error 405 method not allowed. What can be the reason?
Request example: General:
Request URL:http://localhost:xxxxx/api/company
Request Method:OPTIONS
Status Code:405 Method Not Allowed
Response Headers:
Access-Control-Allow-Headers:content-type
Access-Control-Allow-Methods:GET, POST, OPTIONS, PUT, DELETE
Access-Control-Allow-Origin:http://localhost:yyyyy
Allow:GET,POST
Cache-Control:no-cache
Content-Length:76
Content-Type:application/json; charset=utf-8
Request headers:
Accept:*/*
Accept-Encoding:gzip, deflate, br
Accept-Language:pl-PL,pl;q=0.8,en-US;q=0.6,en;q=0.4
Access-Control-Request-Headers:content-type
Access-Control-Request-Method:POST
Connection:keep-alive
Host:localhost:xxxxx
Origin:http://localhost:yyyyy
Referer:http://localhost:yyyyy/ddddd/zzzzzz