maxReceivedMessageSize WCF - c#

I consume a WCF service, but I have a problem
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.
I have modified MaxReceivedMessageSize, but there is no result (I read many articles in the internet, but anyone can't help)
Who knows about this?
Service.config:
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="BindingWithMaxSizeIncreased"
maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="32" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647" />
</binding>
</wsHttpBinding>
</bindings>
<services>
<service name="FootballLife.MyService" behaviorConfiguration="metadataBehavior">
<endpoint
address=""
binding="wsHttpBinding" bindingConfiguration="BindingWithMaxSizeIncreased"
contract="FootballLife.IMyService">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="metadataBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"
multipleSiteBindingsEnabled="true" />
</system.serviceModel>
Client.config
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="BindingWithMaxSizeIncreased"
maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="32" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647" />
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint
address="http://localhost:90/MyService.svc"
binding="wsHttpBinding"
contract="IMyService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</client>
</system.serviceModel>

You need to give the custom bindingConfiguration to your endpoint in the client configuration:
<endpoint address="http://localhost:90/MyService.svc"
binding="wsHttpBinding"
contract="IMyService"
bindingConfiguration="BindingWithMaxSizeIncreased">
<identity>
<dns value="localhost" />
</identity>
</endpoint>

Related

WCF error: wshttpbinding The caller was not authenticated by the service

I have created the WCF stateful service and consume it in my window application. I have faced "The caller was not authenticated by the service" issue While running the application.
Web.Config file:
<bindings>
<wsHttpBinding>
<binding name="wsHttpBinding1" messageEncoding="Text" textEncoding="utf-8">
<!--<security mode="None">-->
<security mode="Message">
<!--<transport clientCredentialType="None"/>-->
<transport clientCredentialType="Windows" proxyCredentialType="None" realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<services>
<service name="REST.IPBX" behaviorConfiguration="ServiceBehavior">
<endpoint address="" binding="wsHttpBinding" contract="WCF_IPBX.IIPBX">
<identity>
<dns value="http://xyz.xxx.w.y/"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>

Windows Service (413) Request Entity Too Large

Please do not delete this as a duplicate
I have a windows service that I am passing an array of objects to. When the array contains less than 150 objects it works successfully. When I pass more than 150 objects I get the (413) Request Entity Too Large Error.
I have tried the feedback from other articles regarding readerQuotas node values and maxReceivedMessageSize, but I am still receiving the error and I am stuck as to what I am still doing wrong.
Here is the app.config of the windows service:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="basicHttpBinding" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647">
<readerQuotas maxDepth="2000000000"
maxStringContentLength="2000000000"
maxArrayLength="2000000000"
maxBytesPerRead="2000000000"
maxNameTableCharCount="2000000000" />
</binding>
</basicHttpBinding>
<wsHttpBinding>
<binding name="wsHttpBindingNoSecurity" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
<security mode="None">
<transport clientCredentialType="None"/>
<message establishSecurityContext="false" negotiateServiceCredential="false"/>
</security>
<readerQuotas maxDepth="2000000000"
maxStringContentLength="2000000000"
maxArrayLength="2000000000"
maxBytesPerRead="2000000000"
maxNameTableCharCount="2000000000" />
</binding>
</wsHttpBinding>
<mexHttpBinding>
<binding name="mexHttpBinding"/>
</mexHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="Service1Behavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="SE.Responder.Integration.AmiOutboundService.AmiObService" behaviorConfiguration="Service1Behavior">
<endpoint address="wsHttp" binding="wsHttpBinding" bindingConfiguration="wsHttpBindingNoSecurity" contract="SE.Responder.Integration.AmiOutboundService.IAmiObService">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="basicHttp" binding="basicHttpBinding" bindingConfiguration="basicHttpBinding" name="basicHttp" contract="SE.Responder.Integration.AmiOutboundService.IAmiObService"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
<host>
<baseAddresses>
<add baseAddress="http://localhost:8732/SE.Responder.Integration.AmiOutboundService/AmiObService/"/>
</baseAddresses>
</host>
</service>
</services>
</system.serviceModel>
And here is the app.config of the executable that passes the data to the windows service:
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IAmiObService" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" >
<readerQuotas maxDepth="2000000000"
maxStringContentLength="2000000000"
maxArrayLength="2000000000"
maxBytesPerRead="2000000000"
maxNameTableCharCount="2000000000" />
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:8732/SE.Responder.Integration.AmiOutboundService/AmiObService/AmiOBService" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IAmiObService" contract="AmiObService.IAmiObService" name="WSHttpBinding_IAmiObService" />
</client>
After reviewing the source code for the application that was having this issue, I found that the wcf service was being hosted in the C# code. I then applied the fix in code as described in the following stack overflow issue,
MaxReceivedMessageSize in WCF Hosted Service in console application,
specifically the following lines,
var wsHttpBinding = new WSHttpBinding();
wsHttpBinding.MaxReceivedMessageSize = int.MaxValue;
Service.AddServiceEndpoint(typeof(TInterfaceContract), wsHttpBinding, EndpointAddress);
which corrected the issue.

WCF REST webHttpBinding - 404 Error

This service I can see the JSON data while calling methods through browser when hosted on our IIS server but after moving it to client's server.. I can't see the data from browser though I can see through WCF Test CLient only... where I'm going wrong.. Could you suggest what should be done.
<bindings>
<wsHttpBinding>
<binding name="LargeSettings" maxBufferPoolSize="524288" maxReceivedMessageSize="6553600">
<readerQuotas maxDepth="32" maxStringContentLength="100000" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
<security mode="None"/>
</binding>
</wsHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="mobserviceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="WebBehavior">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
<services>
<service name="clubconnect.mobservice" behaviorConfiguration="mobserviceBehavior">
<endpoint address="" binding="wsHttpBinding" contract="clubconnect.imobservice" bindingConfiguration="LargeSettings"/>
<endpoint address="ws" binding="webHttpBinding" contract="clubconnect.imobservice" behaviorConfiguration="WebBehavior">
<identity>
<dns value="http://domain"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
You need to add a base address in there:
<host>
<baseAddresses>
<add baseAddress="http://<URL to the .svc file>" />
</baseAddresses>
</host>
Then your relative address for your webHttpBinding endpoint "ws" will resolve to
http://<URL to the .svc file>/ws

WCF Error - 'Maximum number of items that can be serialized or deserialized in an object graph is '65536'

I have facing above error after adding the maxItemsInObjectGraph="2147483647" parameter both server and client.
However in my project large number of data can transferred using "datatable" objects without any issue.
This error occurred large number of data transferred with using "List<>" objects.
My dotnetframework is 4.0, but I found this error NOT found in dotnetframework 4.5 and large number of data can transferring using "List<>" object without error. Also this is Windows base project.
Please anyone can solved this problem. Here are the my server and client app.cofig configurations.
Thanks!!!
My Service;
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="CommonBehavior">
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
<serviceMetadata httpGetEnabled="false"/>
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceThrottling
maxConcurrentSessions="1200"
maxConcurrentCalls="192"
maxConcurrentInstances="1392"
/>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<netTcpBinding>
<binding maxReceivedMessageSize="2147483647" name="netTcpBinding" transferMode="Streamed" listenBacklog="2000" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxConnections="2000"
closeTimeout="08:00:00" openTimeout="08:00:00" receiveTimeout="08:00:00" sendTimeout="08:00:00">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<reliableSession ordered="true" inactivityTimeout="08:00:00"
enabled="false" />
<security mode="None">
<transport clientCredentialType ="None"/>
</security>
</binding>
</netTcpBinding>
</bindings>
<services>
<service behaviorConfiguration="CommonBehavior" name="MyBLL">
<endpoint address="" binding="netTcpBinding" bindingConfiguration="netTcpBinding" name="MyEndPoint" contract="IMy">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:8000/MySVC"/>
</baseAddresses>
</host>
</service>
</services>
</system.serviceModel>
My Client;
<system.serviceModel>
<client>
<endpoint name="MyEndPoint" address="net.tcp://localhost:8000/MySVC" binding="netTcpBinding" bindingConfiguration="netTcpBinding" contract="IMy" />
</client>
<behaviors>
<endpointBehaviors>
<behavior name="CommonBehavior">
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<netTcpBinding>
<binding name="netTcpBinding" maxReceivedMessageSize="2147483647" transferMode="Streamed" listenBacklog="2000" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxConnections="2000"
closeTimeout="08:00:00" openTimeout="08:00:00" receiveTimeout="08:00:00" sendTimeout="08:00:00">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<reliableSession ordered="true" inactivityTimeout="08:00:00"
enabled="false" />
<security mode="None">
<transport clientCredentialType ="None"/>
</security>
</binding>
</netTcpBinding>
</bindings>
<services>
<service behaviorConfiguration="CommonBehavior" name="MyEndPoint">
<endpoint address="" behaviorConfiguration="CommonBehavior" binding="netTcpBinding" bindingConfiguration="netTcpBinding" name="MyEndPoint" contract="Imy">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:8000/MySVC" />
</baseAddresses>
</host>
</service>
</services>
</system.serviceModel>
Finally I found my mistake in client config and I was solved my problem.
My mistake was behaviorConfiguration="CommonBehavior" tag not in the client, endpoint section. After added this part the problem was successfully solved and large number of records exist generic list I can transferred from server to client.
This is my corrected client config -
<system.serviceModel>
<client>
<endpoint name="MyEndPoint" behaviorConfiguration="CommonBehavior" address="net.tcp://localhost:8000/MySVC" binding="netTcpBinding" bindingConfiguration="netTcpBinding" contract="IMy" />
</client>
<behaviors>
<endpointBehaviors>
<behavior name="CommonBehavior">
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<netTcpBinding>
<binding name="netTcpBinding" maxReceivedMessageSize="2147483647" transferMode="Streamed" listenBacklog="2000" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxConnections="2000"
closeTimeout="08:00:00" openTimeout="08:00:00" receiveTimeout="08:00:00" sendTimeout="08:00:00">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<reliableSession ordered="true" inactivityTimeout="08:00:00"
enabled="false" />
<security mode="None">
<transport clientCredentialType ="None"/>
</security>
</binding>
</netTcpBinding>
</bindings>
</system.serviceModel>

Duplex Mode StreamedRequest not working with Reliable Session Binding

I have been struggling with this for a while and could really use some help.
I am attempting to design a WCF endpoint that allows for the streaming of images to the server and then returns imageURLs (i.e: "http://images.site.com/someimage.jpg").
Currently, the call to my WCF method looks like this:
for (var i = 0; i <= (Request.Files.Count - 1); i++)
{
client = new SOAPFileTransferServiceClient();
fileinfo = new FileTransferInfo();
m_objFile = Request.Files[i];
if (!(m_objFile == null | string.IsNullOrEmpty(m_objFile.FileName) | _objFile.ContentLength < 1))
{
fileinfo.FileSize = m_objFile.ContentLength;
fileinfo.FileName = Path.GetFileName(m_objFile.FileName);
fileinfo.UserID = Context.Request["sid"].ToString();
client.UploadFile(fileinfo, m_objFile.InputStream);
if (retParam.param2 == 0)
imgurl.Add(retParam.param1);
}
}
The error I am struggling with is this:
Transfer mode Streamed is not
supported by
ReliableSessionBindingElement.
So far, I have tried creating a custom netTcp binding with
added before the message encoding element. I have also changed my transerMode attribute
to streamedRequest (thanks to a suggestion by marc_s) allowing for the request to be streamed but not the response. This seems like it would do the trick but I am still getting the same error (this time "Transfer mode StreamedRequest is not...").
I am out of ideas.
Below is the file transfer service contract. I have JSON and POX in addition to SOAP endpoints. I also have two MEX endpoints (one for mexHttp and the other for netTcp). Finally, I have both http (for json and pox) and netTcp (for soap) base addresses.
Does anything look wrong?
<service behaviorConfiguration="transferServiceBehavior" name="MyProject.API.FileTransfer.FileTransferService">
<endpoint address="json" behaviorConfiguration="WebHttpEPBehavior"
binding="webHttpBinding" bindingConfiguration="jsonWeb" name="MyJSONFileTransferEP"
contract="MyProject.API.FileTransfer.IJSONFileTransferService" />
<endpoint address="pox" behaviorConfiguration="WebHttpEPBehavior"
binding="webHttpBinding" bindingConfiguration="poxWeb" name="MyPOXFileTransferEP"
contract="MyProject.API.FileTransfer.IPOXFileTransferService" />
<endpoint address="httpMex" binding="mexHttpBinding" bindingConfiguration=""
contract="IMetadataExchange" />
<endpoint address="soap" behaviorConfiguration="NetTcpEPBehavior"
binding="customBinding" bindingConfiguration="netTcpCustom"
name="MySOAPFileTransferEP" contract="MyProject.API.FileTransfer.ISOAPFileTransferService" />
<endpoint address="nettcpMex" binding="netTcpBinding" bindingConfiguration=""
contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:2544/filetransfer/" />
<add baseAddress="net.tcp://localhost:2544/filetransfer/" />
</baseAddresses>
</host>
</service>
And here is my custom binding used by the service contract:
<customBinding>
<binding name="netTcpCustom"
closeTimeout="00:01:00"
openTimeout="00:01:00"
receiveTimeout="00:10:00"
sendTimeout="00:01:00">
<reliableSession />
<compositeDuplex />
<oneWay />
<windowsStreamSecurity protectionLevel="None" />
<mtomMessageEncoding />
<tcpTransport maxBufferPoolSize="524288"
maxReceivedMessageSize="2147483647"
connectionBufferSize="8192"
hostNameComparisonMode="StrongWildcard"
channelInitializationTimeout="00:01:00"
maxBufferSize="2147483647"
maxPendingConnections="20"
maxOutputDelay="00:00:00.2000000"
maxPendingAccepts="5"
transferMode="StreamedRequest"
listenBacklog="20"
portSharingEnabled="false"
teredoEnabled="false">
<connectionPoolSettings groupName="default" leaseTimeout="00:05:00"
idleTimeout="00:02:00" maxOutboundConnectionsPerEndpoint="20" />
</tcpTransport>
</binding>
</customBinding>
Finally, for what it is worth, below is my entire system.serviceModel definition in App.config:
<system.serviceModel>
<client>
<endpoint address="http://localhost:2542/auth/json" behaviorConfiguration="WebHttpEPBehavior"
binding="webHttpBinding" bindingConfiguration="jsonWeb" contract="Trezoro.WebAPI.Authentication.IJSONAuthService"
name="MyJSONAuthEP">
<identity>
<certificateReference storeName="My" storeLocation="LocalMachine"
x509FindType="FindBySubjectDistinguishedName" />
</identity>
</endpoint>
<endpoint address="http://localhost:2542/auth/pox" behaviorConfiguration="WebHttpEPBehavior"
binding="webHttpBinding" bindingConfiguration="poxWeb" contract="Trezoro.WebAPI.Authentication.IPOXAuthService"
name="MyPOXAuthEP">
<identity>
<certificateReference storeName="My" storeLocation="LocalMachine"
x509FindType="FindBySubjectDistinguishedName" />
</identity>
</endpoint>
<endpoint address="http://localhost:2542/auth/soap" behaviorConfiguration="BasicHttpEPBehavior"
binding="basicHttpBinding" bindingConfiguration="soapWeb" contract="Trezoro.WebAPI.Authentication.ISOAPAuthService"
name="MySOAPAuthEP">
<identity>
<certificateReference storeName="My" storeLocation="LocalMachine"
x509FindType="FindBySubjectDistinguishedName" />
</identity>
</endpoint>
<endpoint address="http://localhost:2542/auth/mex" binding="mexHttpBinding"
bindingConfiguration="" contract="IMetadataExchange" name="authmex">
<identity>
<certificateReference storeName="My" storeLocation="LocalMachine"
x509FindType="FindBySubjectDistinguishedName" />
</identity>
</endpoint>
<endpoint address="http://localhost:2543/trade/json" behaviorConfiguration="WebHttpEPBehavior"
binding="webHttpBinding" bindingConfiguration="jsonWeb" contract="Trezoro.WebAPI.Trade.IJSONTradeService"
name="MyJSONTradeEP">
<identity>
<certificateReference storeName="My" storeLocation="LocalMachine"
x509FindType="FindBySubjectDistinguishedName" />
</identity>
</endpoint>
<endpoint address="http://localhost:2543/trade/pox" behaviorConfiguration="WebHttpEPBehavior"
binding="webHttpBinding" bindingConfiguration="poxWeb" contract="Trezoro.WebAPI.Trade.IPOXTradeService"
name="MyPOXTradeEP">
<identity>
<certificateReference storeName="My" storeLocation="LocalMachine"
x509FindType="FindBySubjectDistinguishedName" />
</identity>
</endpoint>
<endpoint address="http://localhost:2543/trade/soap" behaviorConfiguration="BasicHttpEPBehavior"
binding="basicHttpBinding" bindingConfiguration="soapWeb" contract="Trezoro.WebAPI.Trade.ISOAPTradeService"
name="MySOAPTradeEP">
<identity>
<certificateReference storeName="My" storeLocation="LocalMachine"
x509FindType="FindBySubjectDistinguishedName" />
</identity>
</endpoint>
<endpoint address="http://localhost:2543/trade/mex" binding="mexHttpBinding"
bindingConfiguration="" contract="IMetadataExchange" name="trademex">
<identity>
<certificateReference storeName="My" storeLocation="LocalMachine"
x509FindType="FindBySubjectDistinguishedName" />
</identity>
</endpoint>
<endpoint address="http://localhost:2544/filetransfer/json" behaviorConfiguration="WebHttpEPBehavior"
binding="webHttpBinding" bindingConfiguration="jsonWeb" contract="Trezoro.WebAPI.FileTransfer.IJSONFileTransferService"
name="MyJSONFileTransferEP">
<identity>
<certificateReference storeName="My" storeLocation="LocalMachine"
x509FindType="FindBySubjectDistinguishedName" />
</identity>
</endpoint>
<endpoint address="http://localhost:2544/filetransfer/pox" behaviorConfiguration="WebHttpEPBehavior"
binding="webHttpBinding" bindingConfiguration="poxWeb" contract="Trezoro.WebAPI.FileTransfer.IPOXFileTransferService"
name="MyPOXFileTransferEP">
<identity>
<certificateReference storeName="My" storeLocation="LocalMachine"
x509FindType="FindBySubjectDistinguishedName" />
</identity>
</endpoint>
<endpoint address="http://localhost:2545/filetransfer/soap" behaviorConfiguration="NetTcpEPBehavior"
binding="customBinding" bindingConfiguration="netTcpCustom"
contract="Trezoro.WebAPI.FileTransfer.ISOAPFileTransferService"
name="MySOAPFileTransferEP">
<identity>
<certificateReference storeName="My" storeLocation="LocalMachine"
x509FindType="FindBySubjectDistinguishedName" />
</identity>
</endpoint>
<endpoint address="net.tcp://localhost:2545/filetransfer/nettcpMex"
binding="netTcpBinding" bindingConfiguration="" contract="IMetadataExchange"
name="filetransfermex">
<identity>
<certificateReference storeName="My" storeLocation="LocalMachine"
x509FindType="FindBySubjectDistinguishedName" />
</identity>
</endpoint>
</client>
<bindings>
<basicHttpBinding>
<binding name="soapWeb" />
<binding name="httpLargeMessageStream"
closeTimeout="00:01:00"
openTimeout="00:01:00"
receiveTimeout="00:10:00"
sendTimeout="00:01:00"
allowCookies="false"
bypassProxyOnLocal="false"
hostNameComparisonMode="StrongWildcard"
maxBufferSize="2147483647"
maxBufferPoolSize="2147483647"
maxReceivedMessageSize="2147483647"
messageEncoding="Text"
textEncoding="utf-8"
transferMode="StreamedRequest"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32"
maxStringContentLength="8192"
maxArrayLength="16384"
maxBytesPerRead="4096"
maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None"
proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName"
algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
<customBinding>
<binding name="netTcpCustom"
closeTimeout="00:01:00"
openTimeout="00:01:00"
receiveTimeout="00:10:00"
sendTimeout="00:01:00">
<reliableSession />
<compositeDuplex />
<oneWay />
<windowsStreamSecurity protectionLevel="None" />
<mtomMessageEncoding />
<tcpTransport maxBufferPoolSize="524288"
maxReceivedMessageSize="2147483647"
connectionBufferSize="8192"
hostNameComparisonMode="StrongWildcard"
channelInitializationTimeout="00:01:00"
maxBufferSize="2147483647"
maxPendingConnections="20"
maxOutputDelay="00:00:00.2000000"
maxPendingAccepts="5"
transferMode="StreamedRequest"
listenBacklog="20"
portSharingEnabled="false"
teredoEnabled="false">
<connectionPoolSettings groupName="default" leaseTimeout="00:05:00"
idleTimeout="00:02:00" maxOutboundConnectionsPerEndpoint="20" />
</tcpTransport>
</binding>
</customBinding>
<netTcpBinding>
<binding name="netTcpWeb"
hostNameComparisonMode="StrongWildcard"
closeTimeout="00:01:00"
openTimeout="00:01:00"
receiveTimeout="00:10:00"
sendTimeout="00:01:00"
maxReceivedMessageSize="2147483647"
transferMode="StreamedRequest"
portSharingEnabled="false">
<security mode="None" />
</binding>
</netTcpBinding>
<webHttpBinding>
<binding name="poxWeb"
maxBufferSize="1500000"
maxBufferPoolSize="1500000"
maxReceivedMessageSize="1500000">
<readerQuotas maxDepth="32"
maxStringContentLength="656000"
maxArrayLength="656000"
maxBytesPerRead="656000"
maxNameTableCharCount="656000" />
</binding>
<binding name="jsonWeb"
maxBufferSize="1500000"
maxBufferPoolSize="1500000"
maxReceivedMessageSize="1500000">
<readerQuotas maxDepth="32"
maxStringContentLength="656000"
maxArrayLength="656000"
maxBytesPerRead="656000"
maxNameTableCharCount="656000" />
</binding>
</webHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="Default" name="Trezoro.WebAPI.Authentication.AuthService">
<endpoint address="json" behaviorConfiguration="WebHttpEPBehavior"
binding="webHttpBinding" bindingConfiguration="jsonWeb" name="MyJSONAuthEP"
contract="Trezoro.WebAPI.Authentication.IJSONAuthService" />
<endpoint address="pox" behaviorConfiguration="WebHttpEPBehavior"
binding="webHttpBinding" bindingConfiguration="poxWeb" name="MyPOXAuthEP"
contract="Trezoro.WebAPI.Authentication.IPOXAuthService" />
<endpoint address="soap" behaviorConfiguration="BasicHttpEPBehavior"
binding="basicHttpBinding" bindingConfiguration="soapWeb" name="MySOAPAuthEP"
contract="Trezoro.WebAPI.Authentication.ISOAPAuthService" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:2542/auth/" />
</baseAddresses>
</host>
</service>
<service behaviorConfiguration="Default" name="Trezoro.WebAPI.Trade.TradeService">
<endpoint address="json" behaviorConfiguration="WebHttpEPBehavior"
binding="webHttpBinding" bindingConfiguration="jsonWeb" name="MyJSONTradeEP"
contract="Trezoro.WebAPI.Trade.IJSONTradeService" />
<endpoint address="pox" behaviorConfiguration="WebHttpEPBehavior"
binding="webHttpBinding" bindingConfiguration="poxWeb" name="MyPOXTradeEP"
contract="Trezoro.WebAPI.Trade.IPOXTradeService" />
<endpoint address="soap" behaviorConfiguration="BasicHttpEPBehavior"
binding="basicHttpBinding" bindingConfiguration="soapWeb" name="MySOAPTradeEP"
contract="Trezoro.WebAPI.Trade.ISOAPTradeService" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:2543/trade/" />
</baseAddresses>
</host>
</service>
<service behaviorConfiguration="transferServiceBehavior" name="Trezoro.WebAPI.FileTransfer.FileTransferService">
<endpoint address="json" behaviorConfiguration="WebHttpEPBehavior"
binding="webHttpBinding" bindingConfiguration="jsonWeb" name="MyJSONFileTransferEP"
contract="Trezoro.WebAPI.FileTransfer.IJSONFileTransferService" />
<endpoint address="pox" behaviorConfiguration="WebHttpEPBehavior"
binding="webHttpBinding" bindingConfiguration="poxWeb" name="MyPOXFileTransferEP"
contract="Trezoro.WebAPI.FileTransfer.IPOXFileTransferService" />
<endpoint address="httpMex" binding="mexHttpBinding" bindingConfiguration=""
contract="IMetadataExchange" />
<endpoint address="soap" behaviorConfiguration="NetTcpEPBehavior"
binding="customBinding" bindingConfiguration="netTcpCustom"
name="MySOAPFileTransferEP" contract="Trezoro.WebAPI.FileTransfer.ISOAPFileTransferService" />
<endpoint address="nettcpMex" binding="netTcpBinding" bindingConfiguration=""
contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:2544/filetransfer/" />
<add baseAddress="net.tcp://localhost:2544/filetransfer/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="WebHttpEPBehavior">
<webHttp />
</behavior>
<behavior name="BasicHttpEPBehavior" />
<behavior name="NetTcpEPBehavior" />
</endpointBehaviors>
<serviceBehaviors>
<behavior name="Default">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
<behavior name="transferServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
Any and all suggestions much appreciated. Thanks for your help.
Well, does the StreamedRequest method work if you drop the reliable session element? Could you live with that? If you're using netTcp, you're probably behind a corporate firewall, right? So you could possibly get away without the reliable session overhead....
Also - WCF has so many options and possible combinations of features - not everything makes sense, and not everything will work together - maybe this is just a limitation in WCF, not a configuration problem on your part.
The only odd thing about your config is the mtomMessageEncoding in your netTcp custom binding - why not use the much more efficient binary encoding??
<binding name="netTcpCustom"
closeTimeout="00:01:00"
openTimeout="00:01:00"
receiveTimeout="00:10:00"
sendTimeout="00:01:00">
<reliableSession />
<compositeDuplex />
<oneWay />
<windowsStreamSecurity protectionLevel="None" />
<mtomMessageEncoding />
<tcpTransport maxBufferPoolSize="524288"
Why not use
<binaryMessageEncoding />
instead??

Categories