C# WCF System.ServiceModel.QuotaExceededException

7/7/2022 10:22:21 PM by Chris 847
Wenn man die Meldung ```System.ServiceModel.QuotaExceededException: "Die erforderliche Größe zum Speichern der XML-Inhalte überschreitet das Pufferkontingent."``` bekommt, dann hat Stackoverflow die Lösung https://stackoverflow.com/questions/21259954/wcf-error-the-size-necessary-to-buffer-the-xml-content-exceeded-the-buffer-quot#21263803 Ich kopiere mal die Lösung: ``` csharp public class MaxFaultSizeBehavior : IEndpointBehavior { private readonly int _size; public MaxFaultSizeBehavior(int size) { _size = size; } public void Validate(ServiceEndpoint endpoint) { } public void AddBindingParameters(ServiceEndpoint endpoint, BindingParameterCollection bindingParameters) { } public void ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher) { } public void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime) { clientRuntime.MaxFaultSize = _size; } } ``` In dem Posting wird dieser Code zum Hinzufügen vorgeschlagen: ``` csharp _client = new MyServiceClient(); ((ClientBase<IMyService>) _client).Endpoint.Behaviors.Add(new MaxFaultSizeBehavior(1024000)); ``` aber bei mir wars ``` csharp _client = new MyServiceClient(); ((ClientBase<IMyService>) _client).Endpoint.EndpointBehaviors.Add(new MaxFaultSizeBehavior(int.MaxValue)); ```
Tags WCF C#


About author

Chris

Moin, hier sollte ein Text über mich stehen, ggf reiche ich den noch nach, ggf nicht. Manchmal ist es doch auch ganz schön keine Infos über einen Author zu haben :-)


Scroll to Top