My webhook keeps getting 401 - Unauthorized from my IIS-hosted Web API.
The API is just a basic Web API that is configured to receive webhook events from Bitbucket, with a valid HTTPS URL, and I'm using the correct secret key.
WebApiConfig.cs
// Initialize Bitbucket Webhook receiver
config.InitializeReceiveBitbucketWebHooks();
Handler
public class BitBucketWebhookHandler : WebHookHandler
{
public BitBucketWebhookHandler()
{
Receiver = BitbucketWebHookReceiver.ReceiverName;
}
public override Task ExecuteAsync(string receiver, WebHookHandlerContext context)
{
throw new NotImplementedException();
}
}
Web.config
<appSettings>
<add key="MS_WebHookReceiverSecret_Bitbucket" value="<key>"/>
</appSettings>
Global.asax.cs
protected void Application_Start()
{
GlobalConfiguration.Configure(WebApiConfig.Register);
}
All the examples I see is for sites hosted in Azure. I've tried using an Azure-hosted API and it works. Unfortunately, I am required to use IIS. How can I set this up properly?
Which authentication mode should I use? I've tried using Windows, Basic, and Anonymous authentication to no avail.
Any ideas?
Http 401 generally means unauthorized or logged out.
I looked at the IIS logs and the error is actually 401.2 which means a server configuration is preventing access. I'm not sure what configuration it's referring to, though.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.