Andrés Nava - .NET Andrés Nava - .NET - 1 month ago 32
AngularJS Question

405 Method Not Allowed on WebAPI2 (OWIN)

I am setting up a WebAPI endpoint for my API, but am having trouble getting my AngularJS calls to my PostRegister method to work.

The webAPI and Angular are on separate sites.

On the Startup.cs I have:

public void Configuration(IAppBuilder app)

var config = new HttpConfiguration();



private void ConfigureOAuth(IAppBuilder app)
var oAuthServerOptions = new OAuthAuthorizationServerOptions
AllowInsecureHttp = true,
TokenEndpointPath = new PathString(Paths.TokenPath),
AccessTokenExpireTimeSpan = TimeSpan.FromMinutes(30),
Provider = Kernel.Get<IOAuthAuthorizationServerProvider>()

OAuthBearerOptions = new OAuthBearerAuthenticationOptions();

Then on the controller, I have my method that is set to allow anonymous:

public bool PostRegister(UserSignupForm form)

I've also updated the web.config:

<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" />

On the Angular side, I make a simple $ call:

saveRegistration: function (registration) {
return $ + '/api/signup/register', registration).then(function (response) {
return response;

When making the call using Postman, I get a successful response, but when doing the same call from Angular, I get the 405 error.

405 Method Not Allowed

BitOfTech sample site, is sending the same request headers, but is able to get the Access-Control-Allow-XXX headers

enter image description here

I've updated my code to follow Token Based Authentication using ASP.NET Web API 2, Owin, and Identity


I had similar issue recently. I added controller handler for the pre-flight OPTIONS request and it solved the problem.

public async Task<IHttpActionResult> Register()
    return Ok();