title: GenericJson WebHook returns Bad Request
body: <p>I am trying to implement a WebHook for the BuildCompleted event. I am stuck with the error: <em>Bad Request (400)</em> when testing the service hook from the web interface. There seems to be no detailed information about the error in the Event Log or the IIS log files. The <em>Register</em> function in <em>WebApiConfig</em> is hit but the constructor or <em>ExecuteAsync</em> in my WebHook is not.</p>
  
  <p>Any help would be highly appreciated! I am sure that it is some trivial that I just can seem to see myself.</p>
  
  <p>My setup consists of on-prem TFS 2018 Update 2 server and a seperate Windwos Server 2012 with IIS for the the WebHook. I deploy Global.asax and web.config to wwwroot and the assemblies to wwwroot/bin.</p>
  
  <p>Url: <a href="http://MYSERVER/api/webhooks/incoming/genericjson?code=83699ec7c1d794c0c780e49a5c72972590571fd8" rel="nofollow noreferrer">http://MYSERVER/api/webhooks/incoming/genericjson?code=83699ec7c1d794c0c780e49a5c72972590571fd8</a></p>
  
  <p>web.config:</p>
  
  <pre><code>...
  &lt;appSettings&gt;
      &lt;add key="MS_WebHookReceiverSecret_GenericJson" value="83699ec7c1d794c0c780e49a5c72972590571fd8" /&gt;
  &lt;/appSettings&gt;
  ...
  </code></pre>
  
  <p>WebHookHandler:</p>
  
  <pre><code>public class GenericJsonWebHookHandler : WebHookHandler
  {
      public GenericJsonWebHookHandler()
      {
          this.Receiver = GenericJsonWebHookReceiver.ReceiverName;
      }
  
      public override Task ExecuteAsync(string receiver, WebHookHandlerContext context)
      {
          return Task.FromResult(true);
      }
  }
  </code></pre>
  
  <p>WebApiConfig:</p>
  
  <pre><code>public static class WebApiConfig
  {
      public static void Register(HttpConfiguration config)
      {
          // Web API configuration and services
  
          // Web API routes
          config.MapHttpAttributeRoutes();
  
          config.Routes.MapHttpRoute(
              name: "DefaultApi",
              routeTemplate: "api/{controller}/{id}",
              defaults: new {id = RouteParameter.Optional}
          );
  
          // Initialize GenericJson WebHook receiver
          config.InitializeReceiveGenericJsonWebHooks();
      }
  }
  </code></pre>
  
  <p>Global.asax.cs</p>
  
  <pre><code>public class Global : HttpApplication
  {
      protected void Application_Start()
      {
          GlobalConfiguration.Configure(WebApiConfig.Register);
      }
  }
  </code></pre>