您可以通过在< endpoint> 元素上的 bindingConfiguration 属性中指定端点来告知端点使用绑定配置,如下所示: <端点地址=" binding ="webHttpBinding"bindingConfiguration ="webHttpTransportSecurity"contract ="FieldHoundServices.IFHSmartService"behaviorConfiguration ="web"></endpoint> I have a wcf servicethere is a method which gets base64 string to upload a file my file's size 100kb it may be larger in timei got the error message: The remote server returned an error: (413) Request Entity Too Largewhile try to get HttpWebResponsethis is my wcf service web.config<system.serviceModel><bindings> <webHttpBinding> <binding name="webHttpTransportSecurity" allowCookies="false" maxReceivedMessageSize="104857600"> <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" /> <security mode="Transport"> <transport clientCredentialType="None" /> </security> </binding> </webHttpBinding></bindings><services> <service name="FHServices.FHSmartService" behaviorConfiguration="ServiceBehaviour"> <endpoint address="" binding="webHttpBinding" contract="FieldHoundServices.IFHSmartService" behaviorConfiguration="web"> </endpoint> <host> <baseAddresses> <add baseAddress="http://localhost/FHServices/FHSmartService.svc/" /> </baseAddresses> </host> </service></services><behaviors> <serviceBehaviors> <behavior name="ServiceBehaviour"> <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" /> <serviceDebug includeExceptionDetailInFaults="true" /> </behavior> </serviceBehaviors> <endpointBehaviors> <behavior name="web"> <webHttp /> </behavior> </endpointBehaviors></behaviors> <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" /></system.serviceModel>what is my mistake?solvedi found my mistakei remove these codes<security mode="Transport"> <transport clientCredentialType="None" /> </security>i think transport mode for https and we have no ssl so we dont need transport mode. anyway after i remove it, everything seems ok now 解决方案 You don't assign a defined WebHttpBinding configuration to your endpoint, so the endpoint uses the default values for the binding.You can tell the endpoint to use your binding congfiguration by specifying it in the bindingConfiguration attribute on the <endpoint> element, like this:<endpoint address="" binding="webHttpBinding" bindingConfiguration="webHttpTransportSecurity" contract="FieldHoundServices.IFHSmartService" behaviorConfiguration="web"></endpoint> 这篇关于WCF:远程服务器返回错误:(413)请求实体太大的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-09 04:11