Just created a WCF Service that sends files to clients as buffer/stream. And testing it with a client project. At first; when I debug the service on localhost, got that error:
The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element
Since I increased the maxBufferSize and maxReceivedMessageSize values of Client.config from WCF Test Tool; the error was gone. Service returns the buffer with full size.
Then I published the service to the remote server via copy&paste after publishing to file system. When debugging from server and calling the same function; service returns empty buffer.
Here is my web.config:
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true"/>
</appSettings>
<system.web>
<compilation targetFramework="4.5.2" debug="true"/>
<httpRuntime targetFramework="4.5.2" maxRequestLength="67108864"/>
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="LargeBufferBehavior">
<!-- To avoid disclosing metadata information, set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
<dataContractSerializer maxItemsInObjectGraph="67108864"/>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IFileOperationService" closeTimeout="00:05:00" openTimeout="00:05:00" receiveTimeout="00:05:00" sendTimeout="00:05:00" maxBufferPoolSize="524288" maxBufferSize="67108864" maxReceivedMessageSize="67108864" transferMode="StreamedRequest">
<readerQuotas maxDepth="67108864" maxStringContentLength="67108864" maxArrayLength="67108864" maxBytesPerRead="67108864" maxNameTableCharCount="67108864"/>
<security mode="None"/>
</binding>
</basicHttpBinding>
</bindings>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<services>
<service behaviorConfiguration="LargeBufferBehavior" name="EbysIntegrationService.FileOperationService">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IFileOperationService" contract="EbysIntegrationService.IFileOperationService"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<client>
<endpoint address=""
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IFileOperationService"
contract="EbysIntegrationService.IFileOperationService"
name="BasicHttpBinding_IFileOperationService" />
</client>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<directoryBrowse enabled="true"/>
</system.webServer>
</configuration>
One more problem similar to this:
Defined an enum just below the Service Contract Interface:
[DataContract]
[ServiceKnownType(typeof(FileType))]
public static class CompositeType
{
public enum FileType
{
[EnumMember]
SystemFile = 1,
[EnumMember]
Physical = 2,
[EnumMember]
Invalid = 3,
[EnumMember]
Other = 4
}
}
One of the WCF functions returns List with a string value and a FileType object. No problem on local test; return value of List has several elements but the same function on the remote server returns an empty List. Can't fix it yet and need help.
Do I miss a setting on web.config or IIS of remote server? Is it about the permissions of server? Should I make any change on my codes? (File System and Database cridentials are correct, other functions are working correctly)
ps. Sorry If I break the rules of typing format.
You have to increase the maxBufferSize on server to resolve this error.
<bindings>
<basicHttpBinding>
<binding name="basicHttp" allowCookies="true"
maxReceivedMessageSize="20000000"
maxBufferSize="20000000"
maxBufferPoolSize="20000000">
<readerQuotas maxDepth="32"
maxArrayLength="200000000"
maxStringContentLength="200000000"/>
</binding>
</basicHttpBinding>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.