C# 即使使用正确的web.config,WCF消息也太大
我有一个具有以下web.config的WCF服务:C# 即使使用正确的web.config,WCF消息也太大,c#,wcf,http,web-config,basichttpbinding,C#,Wcf,Http,Web Config,Basichttpbinding,我有一个具有以下web.config的WCF服务: <?xml version="1.0"?> <configuration> <system.serviceModel> <behaviors> <serviceBehaviors> <behavior name="MetadataExchange"> <serviceMetadata httpGetEnabl
<?xml version="1.0"?>
<configuration>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="MetadataExchange">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="True"/>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="LargeHttpBinding" maxBufferSize="5064536" maxBufferPoolSize="5064536" maxReceivedMessageSize="5064536">
<readerQuotas maxDepth="32" maxStringContentLength="5064536" maxArrayLength="5064536" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
</binding>
</basicHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="MetadataExchange" name="Service.Interface.ApplicationService.ApplicationService">
<endpoint name="httpEndpoint" address="" binding="basicHttpBinding" bindingConfiguration="LargeHttpBinding" contract="Service.Proxy.ApplicationService.Interfaces.IApplicationService" />
<endpoint name="mexEndpoint" address="mex" binding="mexHttpBinding" bindingConfiguration="" contract="IMetadataExchange"/>
<host>
<baseAddresses>
<add baseAddress="http://localhost:15000/"/>
</baseAddresses>
</host>
</service>
</services>
<client>
<endpoint name="httpEndpoint" address="http://localhost:15000/ApplicationService/ApplicationService.svc" binding="basicHttpBinding" bindingConfiguration="LargeHttpBinding" contract="Service.Proxy.ApplicationService.Interfaces.IApplicationService" />
</client>
</system.serviceModel>
<system.webServer>
<!--ToDo: Set directory browse to false-->
<directoryBrowse enabled="true"/>
<validation validateIntegratedModeConfiguration="false"/>
</system.webServer>
</configuration>
如果我尝试发送大小约为150kb的图片,将抛出一条错误消息,并显示以下消息:
远程服务器返回意外响应:(413)请求实体太大
我是个白痴!测试图片的大小太大了。。。它的尺寸为1920*1080,大小为167kb。但是如果我把它转换成字节数组,它的大小是8MB,因为2073600像素乘以4(a,r,g,b)。。。我应该删除这个问题吗?我是个白痴!测试图片的大小太大了。。。它的尺寸为1920*1080,大小为167kb。但是如果我把它转换成字节数组,它的大小是8MB,因为2073600像素乘以4(a,r,g,b)。。。我应该删除这个问题吗?
basicHttpBinding = new BasicHttpBinding();
basicHttpBinding.MaxBufferSize = 5064536;
basicHttpBinding.MaxBufferPoolSize = 5064536;
basicHttpBinding.MaxReceivedMessageSize = 5064536;
basicHttpBinding.ReaderQuotas.MaxDepth = 32;
basicHttpBinding.ReaderQuotas.MaxStringContentLength = 5064536;
basicHttpBinding.ReaderQuotas.MaxArrayLength = 5064536;
basicHttpBinding.ReaderQuotas.MaxBytesPerRead = 4096;
basicHttpBinding.ReaderQuotas.MaxNameTableCharCount = 16384;