Let me explain you from the begining. There are 3 projects in my solution explorer window in Visual Studio
. Let me explain them one by one. First one is Web Project(ASP.NET Form Based). I need to get some data from 2 different sources. So I have added two different WCF projects in to my solution explorer window in Visual Studio
.
Let me tell you about these 2 WCF projects. First WCF is connected to SOAP web service. Message Encoding type should be Mtom for this SOAP service. By the way this SOAP web service returns byte data(like picture). That's why I have right clicked and then Add> Service Reference option to complete this operation. And as you known this operation updates Web.config file automatically. That's why you see ' binding="wsHttpBinding" ' in Web.config file.
Beside this there is one more WCF project like I mention above. But this works well. I don't have any problem with it.
I have added these two WCF projects in to my Web Project with right clicking Add>Service Reference option. Actually it was working fine until i have try it with large byte data(picture) Let me explain with data sizes: First WCF project is able to bring me a data(picture) with a small size 1.84 KB (1,890 bytes). But same WCF project is not able to bring me a data(picture) with a larger size 164 KB (168,423 bytes). This is the problem. That's why I have shared web.config file of the web project and the web.config file of the First WCF project.
I'm sharing web.config files that are giving errors when displaying a large photo. (You can see web.config file of the web project and web.config file of the first WCF project below)
I have founded&tried lots of solution. But I am still getting same error.
Here is the 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
IIS Version of the web server is: Windows Server 2012 R2, IIS: Version 8.5.9600.16384. I have made a research about this problem. I have found&tried lots of solution. But it did not work.
Here is the web.config file of the WCF project
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.6.1"/>
<pages controlRenderingCompatibilityVersion="4.0"/>
</system.web>
<system.serviceModel>
<bindings>
<customBinding>
<binding name="abcdPortBinding">
<mtomMessageEncoding messageVersion="Soap11" />
<httpsTransport />
</binding>
</customBinding>
<wsHttpBinding>
<binding name="SecureHttpBinding"
closeTimeout="00:10:00"
openTimeout="00:10:00"
sendTimeout="00:10:00"
maxBufferPoolSize="2147483647"
maxReceivedMessageSize="2147483647"
messageEncoding="Mtom">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647" />
<security mode="None">
<transport clientCredentialType="Windows" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="https://abc.abc.com:443/abc-srv/abcPort"
binding="customBinding" bindingConfiguration="abcdPortBinding"
contract="mobilSignatureServiceReference.abcdsrv" name="abcdPort" />
</client>
<behaviors>
<serviceBehaviors>
<behavior name="Servicebehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
<services>
<service behaviorConfiguration="Servicebehavior" name="abcdWcfServisi.abcdServisim">
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="SecureHttpBinding" name="SecureHttp" contract="abcdWcfServisi.IabcdServisim"/>
<host>
<timeouts closeTimeout="00:10:00" openTimeout="00:10:00"/>
</host>
</service>
</services>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
Here is the Web.config file of the web project(asp.net form based project)
<?xml version="1.0"?>
<configuration>
<appSettings>
</appSettings>
<system.web>
<httpRuntime maxRequestLength="1048576" executionTimeout="3600" />
<machineKey validation="3DES"/>
<pages viewStateEncryptionMode="Always" enableViewStateMac="true" controlRenderingCompatibilityVersion="4.0"/>
<trace enabled="false" localOnly="true"/>
<httpCookies httpOnlyCookies="true"/>
<sessionState cookieless="UseCookies"/>
<httpModules>
<add name="myHttpModule" type="myHttpModule"/>
</httpModules>
<compilation debug="true" targetFramework="4.6.1">
<assemblies>
<add assembly="System.Data.OracleClient, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
</assemblies>
</compilation>
<authentication mode="Forms">
<forms name="abc" loginUrl="login.aspx" defaultUrl="abc.aspx" timeout="50000"/>
</authentication>
<customErrors mode="RemoteOnly" defaultRedirect="https://abctest.com">
</customErrors>
</system.web>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="1073741824" />
</requestFiltering>
</security>
<validation validateIntegratedModeConfiguration="false"/>
<defaultDocument>
<files>
<clear/>
<add value="abc.aspx"/>
<add value="abcSecureSrv.svc"/>
</files>
</defaultDocument>
<httpErrors>
<remove statusCode="502" subStatusCode="-1"/>
<remove statusCode="501" subStatusCode="-1"/>
<remove statusCode="500" subStatusCode="-1"/>
<remove statusCode="412" subStatusCode="-1"/>
<remove statusCode="406" subStatusCode="-1"/>
<remove statusCode="405" subStatusCode="-1"/>
<remove statusCode="403" subStatusCode="-1"/>
<remove statusCode="401" subStatusCode="-1"/>
<remove statusCode="404" subStatusCode="-1"/>
<error statusCode="404" prefixLanguageFilePath="" path="https://abctest.com/abc.aspx" responseMode="Redirect"/>
<error statusCode="401" prefixLanguageFilePath="" path="https://abctest.com/abc.aspx" responseMode="Redirect"/>
<error statusCode="403" prefixLanguageFilePath="" path="https://abctest.com/abc.aspx" responseMode="Redirect"/>
<error statusCode="405" prefixLanguageFilePath="" path="https://abctest.com/abc.aspx" responseMode="Redirect"/>
<error statusCode="406" prefixLanguageFilePath="" path="https://abctest.com/abc.aspx" responseMode="Redirect"/>
<error statusCode="412" prefixLanguageFilePath="" path="https://abctest.com/abc.aspx" responseMode="Redirect"/>
<error statusCode="500" prefixLanguageFilePath="" path="https://abctest.com/abc.aspx" responseMode="Redirect"/>
<error statusCode="501" prefixLanguageFilePath="" path="https://abctest.com/abc.aspx" responseMode="Redirect"/>
<error statusCode="502" prefixLanguageFilePath="" path="https://abctest.com/abc.aspx" responseMode="Redirect"/>
</httpErrors>
</system.webServer>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="HttpBinding_abcd"
closeTimeout="00:01:00"
openTimeout="00:01:00"
receiveTimeout="00:10:00"
sendTimeout="00:10:00"
maxBufferPoolSize="2147483647"
maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647"
textEncoding="utf-8"
transferMode="Streamed"
messageEncoding="Text" />
</basicHttpBinding>
<wsHttpBinding>
<binding name="SecureHttp" messageEncoding="Mtom">
<security mode="None" />
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://abctest.com/abcdesube.svc?wsdl"
behaviorConfiguration="SertifikaDavranisi" binding="basicHttpBinding"
bindingConfiguration="HttpBinding_abcd" contract="abcdesube"
name="HttpBinding_abcd" />
<endpoint address="http://localhost:37377/abcdServisim.svc" binding="wsHttpBinding"
bindingConfiguration="SecureHttp" contract="abcdSignature.IabcdServisim"
name="SecureHttp" />
</client>
<behaviors>
<endpointBehaviors>
<behavior name="SertifikaDavranisi">
<dataContractSerializer maxItemsInObjectGraph="2147483646"/>
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="SertifikaDavranisi">
<serviceMetadata httpGetEnabled="true" httpGetUrl=""/>
<serviceDebug httpHelpPageEnabled="true" includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
How can I solve this problem?
<httpsTransport..>
tag has solved the problem.
<customBinding>
<binding>
<httpsTransport maxReceivedMessageSize="2147483647"/>
</binding>
</customBinding>