我正在使用 WCF Web Api 4.0 框架并且遇到了 maxReceivedMessageSize 已超过 65,000 错误。
我已经将我的 webconfig 更新为如下所示,但是因为我正在使用 WCF Web Api,所以我认为这甚至不再使用了,因为我不再使用 webHttpEndpoint?
<standardEndpoints>
<webHttpEndpoint>
<!--
Configure the WCF REST service base address via the global.asax.cs file and the default endpoint
via the attributes on the <standardEndpoint> element below
-->
<standardEndpoint name=""
helpEnabled="true"
automaticFormatSelectionEnabled="true"
maxReceivedMessageSize="4194304" />
</webHttpEndpoint>
在新的 WCF Web Api 中哪里可以指定 MaxReceivedMessageSize?
我也尝试过 CustomHttpOperationHandlerFactory 无济于事:
public class CustomHttpOperationHandlerFactory: HttpOperationHandlerFactory
{
protected override System.Collections.ObjectModel.Collection<HttpOperationHandler> OnCreateRequestHandlers(System.ServiceModel.Description.ServiceEndpoint endpoint, HttpOperationDescription operation)
{
var binding = (HttpBinding)endpoint.Binding;
binding.MaxReceivedMessageSize = Int32.MaxValue;
return base.OnCreateRequestHandlers(endpoint, operation);
}
}