對於較大的文件,我有一個問題設置maxReceivedMessageSize
。WCF - maxReceivedMessageSize
我越來越:
的最大郵件大小配額 傳入消息(65536)已 超標。要增加配額,請使用 MaxReceivedMessageSize屬性 上適當的綁定元素。
這裏是我的服務器端配置:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="HTTPBaseAddress" value="http://localhost:8080/WelcomeMessage/"/>
<add key="HTTPFileTransferAddress" value="http://localhost:8080/FileTransfer/"/>
</appSettings>
<system.web>
<compilation debug="false" />
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
<system.serviceModel>
<services>
<service name="FS.Services.MessageService" behaviorConfiguration="MyServiceTypeBehaviors">
<endpoint contract="FS.Interfaces.IMessageService" address="" binding="wsHttpBinding"/>
</service>
<service name="FS.Services.FileTransferService" behaviorConfiguration="MyServiceTypeBehaviors">
<endpoint contract="FS.Interfaces.IFileTransferService" address="" binding="basicHttpBinding" bindingConfiguration="streamedHttpBinding"/>
</service>
</services>
<bindings>
<basicHttpBinding>
<binding name="streamedHttpBinding"
messageEncoding="Text"
transferMode="Streamed"
maxReceivedMessageSize="400000000"/>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="MyServiceTypeBehaviors">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
這裏是我的客戶端配置:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<client>
<endpoint address="" binding="wsHttpBinding" contract="FS.Services.IMessageService"
name="FS.Services.MessageService" />
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="streamedHttpBinding"
contract="FS.Services.IFileTransferService" name="FS.Services.FileTransferService" />
</client>
<bindings>
<basicHttpBinding>
<binding name="streamedHttpBinding" maxReceivedMessageSize="400000000"
messageEncoding="Text" transferMode="Streamed"/>
</basicHttpBinding>
</bindings>
</system.serviceModel>
</configuration>
我這是怎麼連接的客戶端:
BasicHttpBinding binding2 = new BasicHttpBinding("streamedHttpBinding");
EndpointAddress endpoint2 = new EndpointAddress("http://localhost:8080/FileTransfer");
ChannelFactory<IFileTransferService> channelFactory2 = new ChannelFactory<IFileTransferService>(binding2, endpoint2);
IFileTransferService proxy2 = channelFactory2.CreateChannel();
((IClientChannel)proxy2).Open();
而且我想使用st轉換任何類型的文件高達500MB令消息。 有人可以請我提供配置(或解決方案),將支持嗎?
Thanx!
對不起...我已經嘗試插入代碼,但只有第一行出現... – no9 2010-12-21 10:03:38
好的thanx,固定的。 – no9 2010-12-21 10:19:48