WCF: maxStringContentLength always set to 8192

前端 未结 2 763
难免孤独
难免孤独 2020-12-30 04:53

I need to change the maxStringContentLength to a value larger than 8192 but have not been successful in doing it. My WCF service will generate an exception if the amount of

2条回答
  •  天涯浪人
    2020-12-30 05:42

    By default, the latest version of WCF does in fact setup defaults and json is the default. What wasn't clear was what kind of default binding WCF was using. It turns out to be webHttpBinding. You will also see a ton of examples on the web showing attributes being applied to the service method, such as [WebGet]. The method requires no attributes at all. For maxStringContentLength to take affect, you need to correctly setup the binding and behavior. Here is the correct entries in the web.config file:

    
      
        
          
            
          
        
        
          
            
          
        
      
      
        
          
            
              
            
          
          
        
      
      
        
          
            
          
        
       
      
    
    

提交回复
热议问题