Guest User

Untitled

a guest
Jun 25th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.68 KB | None | 0 0
  1. My Server Config:
  2.  
  3. <?xml version="1.0" encoding="utf-8" ?>
  4. <configuration>
  5. <system.serviceModel>
  6. <services>
  7. <service name="[my-service-name]">
  8. <endpoint address="http://localhost:8005/MyService"
  9. binding="webHttpBinding"
  10. contract="[my-service-contract-name]"/>
  11. </service>
  12. </services>
  13. <bindings>
  14. <basicHttpBinding>
  15. <binding maxReceivedMessageSize="2147483647"
  16. maxBufferSize="2147483647"
  17. maxBufferPoolSize="2147483647">
  18. <readerQuotas maxDepth="32"
  19. maxArrayLength="2147483647"
  20. maxStringContentLength="2147483647"/>
  21. </binding>
  22. </basicHttpBinding>
  23. </bindings>
  24. <behaviors>
  25. <serviceBehaviors>
  26. <behavior>
  27. <serviceMetadata httpGetEnabled="true"/>
  28. <serviceDebug includeExceptionDetailInFaults="true"/>
  29. <dataContractSerializer maxItemsInObjectGraph="2147483647" />
  30. </behavior>
  31. </serviceBehaviors>
  32. </behaviors>
  33. </system.serviceModel>
  34. <startup>
  35. <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
  36. </startup>
  37. </configuration>
  38.  
  39.  
  40. My Service:
  41.  
  42. [OperationContract]
  43. [WebInvoke(Method = "POST", UriTemplate = "MyService")]
  44. void MyService(String input)
  45. {
  46. Console.WriteLine("Request data = " + input.Length);
  47. }
  48.  
  49.  
  50.  
  51. Client Config:
  52.  
  53. <?xml version="1.0" encoding="utf-8" ?>
  54. <configuration>
  55. <startup>
  56. <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
  57. </startup>
  58. <system.serviceModel>
  59. <bindings>
  60. <basicHttpBinding>
  61. <binding name="name-here" maxReceivedMessageSize="2147483647">
  62. </binding>
  63. </basicHttpBinding>
  64. </bindings>
  65. <behaviors>
  66. <serviceBehaviors>
  67. <behavior name="behavior-here">
  68. <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
  69. </behavior>
  70. </serviceBehaviors>
  71. </behaviors>
  72. </system.serviceModel>
  73.  
  74. In your config, please add
  75. "<dataContractSerializer maxItemsInObjectGraph="2147483647"/>"
  76.  
  77. Service Config:
  78. <behaviors>
  79. <serviceBehaviors>
  80. <behavior>
  81. <serviceMetadata httpGetEnabled="true"/>
  82. <serviceDebug includeExceptionDetailInFaults="true"/>
  83. <dataContractSerializer maxItemsInObjectGraph="2147483647" />
  84. </behavior>
  85. </serviceBehaviors>
  86. </behaviors>
  87.  
  88. Client Config:
  89. <behaviors>
  90. <serviceBehaviors>
  91. <behavior name="MyServiceBehavior">
  92. <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
  93. </behavior>
  94. </serviceBehaviors>
  95. </behaviors>
Add Comment
Please, Sign In to add comment