I have a Web Api 2 application hosted in Service Fabric which is using Microsoft.AspNet.WebApi.OwinSelfHost to host the service. My Startup class is pretty typical:
public static class Startup
{
public static void ConfigureApp(IAppBuilder app)
{
var config = new HttpConfiguration();
config.MapHttpAttributeRoutes();
// ...
app.UseWebApi(config);
}
}
The service farbric service is starting the web listener in its CreateServiceInstanceListeners()
method:
protected override IEnumerable<ServiceInstanceListener> CreateServiceInstanceListeners()
{
return new[]
{
new ServiceInstanceListener(serviceContext => new OwinCommunicationListener(Startup.ConfigureApp, serviceContext, "WebApiEndpoint"))
};
}
OwinCommunicationListener is a service fabric listener which will eventually start the web server:
public Task<string> OpenAsync(CancellationToken cancellationToken)
{
// ...
WebApp.Start(this.listeningAddress, appBuilder => this.startup(appBuilder)));
return Task.FromResult(this.publishAddress);
}
I am running into an issue with some requests where I am trying to pass a large amount of data over the request headers. I seem to be hitting the limit because my requests are getting rejected with the following:
Bad Request - Request Too Long HTTP Error 400. The size of the request headers is too long.
Is there a way to configure the self hosted web api to increase the limit of the request headers?