MR.ABC
MR.ABC

Reputation: 4862

WCF ServiceRoute POST 405 method not allowed

I get an error on any OperationContract with POST: 405 method not allowed
GET work just fine. I've tried it on local and remote server with the webserver e.g. localhost/myPostMethod/myParam

I host the service like these :

   RouteTable.Routes.Add(
        new ServiceRoute(@"Default",
            new CustomWebServiceHostFactory(),
            typeof(DefaultService)));

(i use the webHttpBinding inside my CustomWebServiceHostFactory)
Can not change any settings inside IIS on my remote server. I think it's not necessary ether. Seems like the problem is somewhere inside my code.

Tried many thinks and i'm a little bit desperate right now. Would be very happy about any suggestions.

Upvotes: 1

Views: 1775

Answers (1)

MR.ABC
MR.ABC

Reputation: 4862

Added header... Solved.

  <system.webServer>
    <httpProtocol>
      <customHeaders>
        <add name="Access-Control-Allow-Methods" value="GET, POST" />
      </customHeaders>
    </httpProtocol>
  </system.webServer>

Upvotes: 1

Related Questions