【发布时间】:2018-02-02 09:33:45
【问题描述】:
我有一个托管在 Service Fabric 中的 Web Api 2 应用程序,它使用 Microsoft.AspNet.WebApi.OwinSelfHost 来托管服务。我的 Startup 课程非常典型:
public static class Startup
{
public static void ConfigureApp(IAppBuilder app)
{
var config = new HttpConfiguration();
config.MapHttpAttributeRoutes();
// ...
app.UseWebApi(config);
}
}
service farbric 服务正在其CreateServiceInstanceListeners() 方法中启动网络监听器:
protected override IEnumerable<ServiceInstanceListener> CreateServiceInstanceListeners()
{
return new[]
{
new ServiceInstanceListener(serviceContext => new OwinCommunicationListener(Startup.ConfigureApp, serviceContext, "WebApiEndpoint"))
};
}
OwinCommunicationListener 是一个服务结构监听器,它最终会启动 Web 服务器:
public Task<string> OpenAsync(CancellationToken cancellationToken)
{
// ...
WebApp.Start(this.listeningAddress, appBuilder => this.startup(appBuilder)));
return Task.FromResult(this.publishAddress);
}
我在尝试通过请求标头传递大量数据时遇到了一些请求的问题。我似乎达到了极限,因为我的请求被以下内容拒绝:
错误请求 - 请求太长 HTTP 错误 400。请求标头的大小太长。
有没有办法配置自托管 web api 来增加请求标头的限制?
【问题讨论】:
标签: c# asp.net-web-api owin self-host-webapi