KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
There are a lot of similar questions out there, but I have tried every solution in every one of them to no avail. We have a web service that initialises with WebServiceHostFactory, but if any more than 64k is thrown at it, we get a '400 Bad Request'. Normally, this would just be resolved by bumping up the MaxReceivedMessageSize, MaxBufferSize and MaxBufferPoolSize. The problem is that using the WebServiceHostFactory, the Web.Config is completely ignored. No changes I make in the ServiceModel section reflect in the service at all. It would be nice to just completely ditch WebServiceHostFactory and set up the web.config from scratch, but our service will not run without it. One of the methods has a stream parameter as well as some other string params. Without the factory, we get System.InvalidOperationException: For request in operation Test to be a stream the operation must have a single parameter whose type is Stream So it is not an option to remove the factory. I can't work out exactly what the factory is doing that fixes this error but I spent 4 days on it and never got anywhere. I've also tried overriding MaxReceivedMessageSize programatically, with some examples I found on around the place: protected override void OnOpening() { base.OnOpening(); foreach (var endpoint in Description.Endpoints) { //var binding = endpoint.Binding as WebHttpBinding; //if (binding != null) //{ // binding.MaxReceivedMessageSize = 20000000; // binding.MaxBufferSize = 20000000; // binding.MaxBufferPoolSize = 20000000; // binding.ReaderQuotas.MaxArrayLength = 200000000; // binding.ReaderQuotas.MaxStringContentLength = 200000000; // binding.ReaderQuotas.MaxDepth = 32; //} //v
Tags (comma-separated)
Save Edits
Cancel