Sending object to WCF service. MaxStringContentLength (8192 bytes) exceeded when deserializing

后端 未结 2 1423
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-25 15:09

I created a simple WCF web service that has one method: SubmitTicket(flightticket ft, string username, string password)

On the client side, I have an application for fil

2条回答
  •  日久生厌
    2021-01-25 15:46

    This is the answer! I have searched everywhere the solution to this problem in WCF 4.0, and this entry by Richard Blewett was the final piece of the puzzle.

    Key things learned from my research:

    • if the exception is thrown by the service, then only change the Server Web.config file; don't worry about the client
    • create a custom basicHttpBinding:
    
        
            
                
    
    • add the larger readerQuota values (largest possible shown here, adjust to taste)
            
              
            
        
    
    
    • create a service entry, with an endpoint that maps to the custom binding. The mapping happens when the endpoint's bindingConfiguration is the same as the binding's name:
    • Make sure the service name and the contract value are fully qualified - use the namespace, and the name of the class.
    
        
            
                 
            
        
    

提交回复
热议问题