解决:WCF:远程服务器返回错误:(413)请求实体过大 [英] solved: WCF: The remote server returned an error: (413) Request Entity Too Large
问题描述
我有一个WCF服务
有它获取的base64字符串上传的文件我的文件大小100KB,可能在时间上大的方法
there is a method which gets base64 string to upload a file my file's size 100kb it may be larger in time
我得到了错误消息:远程服务器返回错误:(413)请求实体过大
,而试图让HttpWebResponse
i got the error message : The remote server returned an error: (413) Request Entity Too Large while try to get HttpWebResponse
这是我的WCF服务的web.config
this 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?
@编辑:
I发现我的错误
I删除这些代码
@edit: i found my mistake i remove these codes
<security mode="Transport">
<transport clientCredentialType="None" />
</security>
我觉得对于HTTPS传输模式,我们也没有SSL,以便我们不需要传输模式。反正后,我将其删除,一切似乎确定现在
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
推荐答案
您不分配定义的的WebHttpBinding
配置您的端点,所以端点使用的缺省值的绑定。
You don't assign a defined WebHttpBinding
configuration to your endpoint, so the endpoint uses the default values for the binding.
您可以告诉端点通过指定其使用你的绑定congfiguration在对<的
元素,像这样的: bindingConfiguration
属性;端点>
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)请求实体过大的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!