title: Azure function (HttpTrigger) exception when referencing a .NET standard class library
body: <p>I'm using the WebJob SDK to create an Azure Function in Visual Studio 2017 (specifically an outgoing Slack WebHook).</p>
  
  <pre><code>public static async Task&lt;HttpResponseMessage&gt; Run(
          [HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)]HttpRequestMessage req,
          TraceWriter log)
  </code></pre>
  
  <p>I can debug the function locally, and execute it successfully.</p>
  
  <p>I then add a reference to a <strong>new</strong> .NET standard class library, compile and debug, and upon triggering the function, am presented with the following error.</p>
  
  <pre><code>{
    "id": "2badc751-bd37-4482-90db-6dde1247110c",
    "requestId": "60acb725-546e-4e62-9868-a5bd4c217bfc",
    "statusCode": 500,
    "errorCode": 0,
    "message": "Exception while executing function: SlackWebHooks -&gt; Exception binding parameter 'req' -&gt; No MediaTypeFormatter is available to read an object of type 'HttpRequestMessage' from content with media type 'application/x-www-form-urlencoded'.",
    "errorDetails": "Microsoft.Azure.WebJobs.Host.FunctionInvocationException : Exception while executing function: SlackWebHooks ---&gt; System.InvalidOperationException : Exception binding parameter 'req' ---&gt; System.Net.Http.UnsupportedMediaTypeException : No MediaTypeFormatter is available to read an object of type 'HttpRequestMessage' from content with media type 'application/x-www-form-urlencoded'.\r\n   at System.Net.Http.HttpContentExtensions.ReadAsAsync[T](HttpContent content,Type type,IEnumerable`1 formatters,IFormatterLogger formatterLogger,CancellationToken cancellationToken)\r\n   at async Microsoft.Azure.WebJobs.Extensions.Http.HttpTriggerAttributeBindingProvider.HttpTriggerBinding.CreateUserTypeValueProvider(HttpRequestMessage request,String invokeString)\r\n   at async Microsoft.Azure.WebJobs.Extensions.Http.HttpTriggerAttributeBindingProvider.HttpTriggerBinding.BindAsync(Object value,ValueBindingContext context)\r\n   at async Microsoft.Azure.WebJobs.Host.Triggers.TriggeredFunctionBinding`1.BindCoreAsync[TTriggerValue](ValueBindingContext context,Object value,IDictionary`2 parameters) \r\n   End of inner exception\r\n   at Microsoft.Azure.WebJobs.Host.Executors.DelayedException.Throw()\r\n   at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithWatchersAsync(IFunctionInstance instance,ParameterHelper parameterHelper,TraceWriter traceWriter,ILogger logger,CancellationTokenSource functionCancellationTokenSource)\r\n   at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithLoggingAsync(??)\r\n   at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithLoggingAsync(??) \r\n   End of inner exception\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithLoggingAsync(??)\r\n   at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.TryExecuteAsync(IFunctionInstance functionInstance,CancellationToken cancellationToken)\r\n   at Microsoft.Azure.WebJobs.Host.Executors.ExceptionDispatchInfoDelayedException.Throw()\r\n   at async Microsoft.Azure.WebJobs.JobHost.CallAsync(??)\r\n   at async Microsoft.Azure.WebJobs.Script.ScriptHost.CallAsync(String method,Dictionary`2 arguments,CancellationToken cancellationToken)\r\n   at async Microsoft.Azure.WebJobs.Script.WebHost.WebScriptHostManager.HandleRequestAsync(FunctionDescriptor function,HttpRequestMessage request,CancellationToken cancellationToken)\r\n   at async Microsoft.Azure.WebJobs.Script.WebHost.Controllers.FunctionsController.ProcessRequestAsync(HttpRequestMessage request,FunctionDescriptor function,CancellationToken cancellationToken)\r\n   at async Microsoft.Azure.WebJobs.Script.WebHost.Controllers.FunctionsController.&lt;&gt;c__DisplayClass3_0.&lt;ExecuteAsync&gt;b__0(??)\r\n   at async Microsoft.Azure.WebJobs.Extensions.Http.HttpRequestManager.ProcessRequestAsync(HttpRequestMessage request,Func`3 processRequestHandler,CancellationToken cancellationToken)\r\n   at async Microsoft.Azure.WebJobs.Script.WebHost.Controllers.FunctionsController.ExecuteAsync(HttpControllerContext controllerContext,CancellationToken cancellationToken)\r\n   at async System.Web.Http.Dispatcher.HttpControllerDispatcher.SendAsync(HttpRequestMessage request,CancellationToken cancellationToken)\r\n   at async System.Web.Http.Dispatcher.HttpControllerDispatcher.SendAsync(HttpRequestMessage request,CancellationToken cancellationToken)\r\n   at async Microsoft.Azure.WebJobs.Script.WebHost.Handlers.SystemTraceHandler.SendAsync(HttpRequestMessage request,CancellationToken cancellationToken)\r\n   at async Microsoft.Azure.WebJobs.Script.WebHost.Handlers.WebScriptHostHandler.SendAsync(HttpRequestMessage request,CancellationToken cancellationToken)\r\n   at async System.Web.Http.HttpServer.SendAsync(HttpRequestMessage request,CancellationToken cancellationToken)"
  }
  </code></pre>
  
  <p>I'm unsure as to why referencing the .NET standard library would change the behaviour of the SDK? But it's apparent it's related to <code>MediaTypeFormatter</code>, or there lack of.</p>