Large data transfer using wsDualHttpbinding fails - wcf

I'm trying to send data of size greater than 25 MB to multiple clients at the same time using callbacks. I have implemented the service with wsdualhttp binding. It throws "System.OutofMemory" and "Failed to allocate memory" exceptions when the service tries to send the data to more than 3 clients concurrently. I have set relevant values for serviceThrottling, maxItemsInObjectGraph as well as maxBufferPoolSize. Also, I cannot use streaming. Is there a way to achieve this?
// Server Side
<?xml version="1.0"?>
<configuration>
<system.net>
<connectionManagement>
<add address="*" maxconnection="2147483647"/>
</connectionManagement>
</system.net>
<system.serviceModel>
<bindings>
<wsDualHttpBinding>
<binding name="WSConfig" closeTimeout="00:10:00" openTimeout="00:01:00"
receiveTimeout="00:20:00" sendTimeout="00:20:00" bypassProxyOnLocal="false"
transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483647"
maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" >
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
<reliableSession ordered="true" inactivityTimeout="00:10:00"/>
</binding>
</wsDualHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="ServiceBehavior" name="CallbackService.MycallbackService">
<endpoint address="http://localhost:8000/MycallbackService/MyService" binding="wsDualHttpBinding" contract="CallbackService.IServiceContract" bindingConfiguration="WSConfig">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false "/>
<serviceThrottling maxConcurrentCalls="2147483647" maxConcurrentInstances="2147483647" maxConcurrentSessions="1000"/>
<dataContractSerializer maxItemsInObjectGraph="2147483646"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
</configuration>
//Client Side
<?xml version="1.0"?>
<configuration>
<system.net>
<connectionManagement>
<add address ="*" maxconnection = "2147483647" />
</connectionManagement>
</system.net>
<system.serviceModel>
<bindings>
<wsDualHttpBinding>
<binding name ="WSConfig" closeTimeout="00:10:00"
openTimeout="00:01:00" receiveTimeout="00:20:00" sendTimeout="00:20:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647"
maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"/>
</binding>
</wsDualHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:8000/MycallbackService/MyService" binding="wsDualHttpBinding" contract="CallbackService.IServiceContract" bindingConfiguration ="WSConfig">
</endpoint>
</client>
</system.serviceModel>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
</startup>

For those still looking into this: I've had the same problem and it turned out that the data exchanged were too big for the serlializer/deserializer. This in turn caused System.OutofMemory errors. You may want to try some other binding (For example NetTcpBinding which supports binary encoding)
Also: Make sure that both your client and service are compiled for the same architecture (if your service addresses a 64bit namespace and your client compiled for 32bit, then you're bound to get System.OutofMemory exceptions

Related

wsHttpBinding to WCF Service hosted in IIS throughput issue

I have a client application for load testing, which is used as payload generator. The application is a client to WCF service hosted in IIS with secure wsHttpBinding. In addition, the WCF service hosted in IIS is a middle tier which is also a client to another asynchronous WCF service hosted in Windows services using netTcpBinding.
While load testing I couldn't go beyond 10-12 requests per second. I have the right throttling configuration as shown below.
Here is my configuration for the application that is client to the service hosted in IIS
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<services>
<service behaviorConfiguration="ews.behavior" name="ServiceLoadTest.ProcessLoadRequest">
<endpoint address="" binding="netTcpBinding" bindingConfiguration="ews.search.netTcp" contract="ServiceLoadTest.IProcessLoadRequest" />
<endpoint address=""
binding="wsHttpBinding" bindingConfiguration="ews.wsHttp"
contract="EWSServiceLoadTest.IProcessLoadRequest" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:3300/load/" />
<add baseAddress="http://localhost:3301/load/" />
</baseAddresses>
</host>
</service>
</services>
<bindings>
<netTcpBinding>
<binding name="ews.search.netTcp" closeTimeout="00:05:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:05:00" transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions" hostNameComparisonMode="StrongWildcard" listenBacklog="1000" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxConnections="2000" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="32767" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="None" />
</binding>
<binding name="ews.netTcp">
<security mode="None" />
</binding>
</netTcpBinding>
<wsHttpBinding>
<binding name="WSHttpBinding_ISearchData" closeTimeout="00:05:00" openTimeout="00:05:00" receiveTimeout="00:05:00" sendTimeout="00:05:00"
maxBufferPoolSize="2147483647"
maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647"
maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="Transport">
<transport clientCredentialType="None" />
<message clientCredentialType="None" negotiateServiceCredential="false" />
</security>
</binding>
<binding name="ews.wsHttp" closeTimeout="00:05:00" openTimeout="00:05:00" receiveTimeout="00:05:00" sendTimeout="00:05:00"
maxBufferPoolSize="2147483647"
maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647"
maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="None" />
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="https://[dnsName]/SearchData/Search.svc"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_ISearchData"
contract="SearchDataReference.ISearchData"
name="WSHttpBinding_ISearchData">
<identity>
<dns value="[dnsName]" />
</identity>
</endpoint>
</client>
<behaviors>
<serviceBehaviors>
<behavior name="ews.behavior">
<serviceDebug includeExceptionDetailInFaults="true"/>
<serviceMetadata httpGetEnabled="true" />
<serviceThrottling maxConcurrentCalls="5000" maxConcurrentSessions="5000" maxConcurrentInstances="5000"/>
<serviceTimeouts transactionTimeout="00:05:00" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
And here is web.config file for WCF service hosted in IIS
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.serviceModel>
<extensions>
<behaviorExtensions>
<add name="wsdlExtensions" type="WCFExtrasPlus.Wsdl.WsdlExtensionsConfig, WCFExtrasPlus" />
</behaviorExtensions>
</extensions>
<services>
<service behaviorConfiguration="ews.behavior" name="SearchData">
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="ews.secure.wsHttp"
behaviorConfiguration="FlatWsdlBehaviour" contract="Contracts.ISearchData">
<identity>
<dns value="[dnsname]" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="https://[dnsname]/SearchData/Search.svc" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="FlatWsdlBehaviour">
<wsdlExtensions location="https://[dnsname]/SearchData/Search.svc" singleFile="true" />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="ews.behavior">
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceMetadata httpsGetEnabled="true" />
<serviceThrottling maxConcurrentCalls="5000" maxConcurrentSessions="5000" maxConcurrentInstances="5000" />
<serviceTimeouts transactionTimeout="00:05:00" />
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<netTcpBinding>
<binding name="NetTcpBinding_AllAsync" closeTimeout="00:10:00"
openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
hostNameComparisonMode="StrongWildcard" listenBacklog="5000"
maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxConnections="5000"
maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647"
maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="None">
</security>
</binding>
</netTcpBinding>
<wsHttpBinding>
<binding name="ews.secure.wsHttp" closeTimeout="00:05:00" openTimeout="00:05:00" receiveTimeout="00:05:00" sendTimeout="00:05:00"
maxBufferPoolSize="2147483647"
maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647"
maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="Transport">
<transport clientCredentialType="None" />
<message clientCredentialType="None" negotiateServiceCredential="false" />
</security>
</binding>
</wsHttpBinding>
<wsDualHttpBinding>
<binding name="WSDualHttpBinding_AllAsync" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="16384" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<reliableSession ordered="true" inactivityTimeout="00:10:00" />
<security mode="None" />
</binding>
</wsDualHttpBinding>
</bindings>
<client>
<endpoint address="net.tcp://localhost:5536/NMVTISCheckForDataOnlineCallback"
binding="netTcpBinding" bindingConfiguration="NetTcpBinding_AllAsync"
contract="CheckForDataReference.IProcessCheckForDateOnlineAsync" name="NetTcpBinding_IProcessCheckDataOnlineAsync">
</endpoint>
<endpoint address="http://localhost:5525/NMVTISCheckForVinOnlineCallback"
binding="wsDualHttpBinding" bindingConfiguration="WSDualHttpBinding_AllAsync"
contract="CheckForDataReference.IProcessCheckForDataOnlineAsync" name="WSDualHttpBinding_IProcessCheckDataOnlineAsync">
</endpoint>
</client>
</system.serviceModel>
<runtime>
<gcServer enabled="true" />
</runtime>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
</startup>
</configuration>
In order to improve the performance of a IIS hosted WCF service, you may need to adjust the application pool settings. The following code snippet shows an example configuration setting:
<system.web>
<applicationPool maxConcurrentRequestsPerCPU="x" maxConcurrentThreadsPerCPU="x" requestQueueLimit="x"/>
</system.web>
Refer to the following MSDN page for additional information:
http://msdn.microsoft.com/en-us/library/ee377050.aspx

WCF Service: File upload ends in Protocol exception: MaxArraylength exceeded

I'm coding a webservice at the moment and the usage is as followed:
I got a frontend as dll, means I got a library project with a wpf window.
That library shall be called from other programs.
The Backend WCF-service is hosted on an external IIS and the frontend calls the webservice methods via a controller.dll where the wcf service is referenced.
I've read several post here and from google already about the same issue...but I can't get it fixed.
I got a dummy windows forms, which calls the frontend.dll.
That project got that app.config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647"
maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://Hidden-ip/TicketReportService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService"
contract="ServiceReference.IService" name="BasicHttpBinding_IService" />
</client>
</system.serviceModel>
</configuration>
I'm aware, that each program that wants to call my frontend.dll would need to put the binding/endpoint configurations in their own app.config if I proceed like i described here.
Thats just an example though, later I'm doing the binding/endpoint config programaticallly in my controller.dll, so I dont need configuration files...but thats another topic.
If I call my method, that uploads the file via the webservice I got two scenarios:
if file > 16kb and <~30kb I get a protoccol exception, thats telling me that the "MaxArrayLength" (16384) was exceeded.
if I'm trying to upload a file with about 60kb I get a protocoll exception as well, but just with the information: "remoteserver returned unexpected answer.(400) bad request.
If you look in the app.config, the maxarray length is setted to int32.max value.
Also if I check the binding of the object that calls the method, its telling me that the maxarraylength was taken from the app.config....but I'm still getting the error message.
What did I wrong here?
Thats a client side issue, i'snt it?
In my service web.config on the IIS I got following:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.serviceModel>
<services>
<service behaviorConfiguration="BackendService.Behavior" name="MyNamespaye.Service">
<endpoint address="" binding="basicHttpBinding" contract="MyNamespaye.IService" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="BackendService.Behavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
<connectionStrings>
<add name="CustomerEntities" connectionString="metadata=res://*/CustomerModel.csdl|res://*/CustomerModel.ssdl|res://*/CustomerModel.msl;provider=MySql.Data.MySqlClient;provider connection string="server=hidden-ip;User Id=root;database=fromcloud;password=hidden-pw;Persist Security Info=True"" providerName="System.Data.EntityClient" />
<add name="DocumentEntities" connectionString="metadata=res://*/DocumentModel.csdl|res://*/DocumentModel.ssdl|res://*/DocumentModel.msl;provider=MySql.Data.MySqlClient;provider connection string="server=hidden-ip;User Id=root;password=hidden-pw;Persist Security Info=True;database=fromcloud"" providerName="System.Data.EntityClient" />
</connectionStrings>
</configuration>
...fixed it myself. Didn't know that it has to be configured on the service side as well!
new web.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IService" closeTimeout="00:10:00"
openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647"
maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="BackendService.Behavior" name="MyNamespace.Service">
<host>
<baseAddresses>
<add baseAddress="http://localhost:1111/"/>
</baseAddresses>
</host>
<endpoint address="http://MyIP/TicketReportService.svc"
binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IService"
contract="Mynamespace.BackendService.IService"
name="ticketReport_endpoint" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="BackendService.Behavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
<connectionStrings>
<add name="CustomerEntities" connectionString="metadata=res://*/CustomerModel.csdl|res://*/CustomerModel.ssdl|res://*/CustomerModel.msl;provider=MySql.Data.MySqlClient;provider connection string="server=fwefwef;User Id=root;database=fromcloud;password=fwefw;Persist Security Info=True"" providerName="System.Data.EntityClient" />
<add name="DocumentEntities" connectionString="metadata=res://*/DocumentModel.csdl|res://*/DocumentModel.ssdl|res://*/DocumentModel.msl;provider=MySql.Data.MySqlClient;provider connection string="server=fwefwef;User Id=root;password=fwef;Persist Security Info=True;database=fromcloud"" providerName="System.Data.EntityClient" />
</connectionStrings>
</configuration>
...just did another google search and found a proper exampel of a web.config.
Thanks anyway for anyone that read the OP.

Can't get WCF Host configuration to a client with adding Service Reference

I prepared a wcf service host and configured with some binding information below.
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<standardEndpoints>
<webHttpEndpoint>
<standardEndpoint name="" helpEnabled="true" automaticFormatSelectionEnabled="true" />
</webHttpEndpoint>
</standardEndpoints>
<bindings>
<netTcpBinding>
<binding name="NetTcpBinding" closeTimeout="00:02:00" openTimeout="00:02:00"
receiveTimeout="00:20:00" sendTimeout="00:02:00" transactionFlow="true"
transferMode="Buffered" maxBufferPoolSize="2147483647"
maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647" />
<security mode="None">
<transport protectionLevel="None" />
</security>
</binding>
</netTcpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="tcpServiceBehavior">
<serviceMetadata httpGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="tcpServiceBehavior" name="MyClass">
<endpoint address="" binding="netTcpBinding" bindingConfiguration="NetTcpBinding" contract="IMyClass">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:8732/Design_Time_Addresses/MyService/MyClass" />
</baseAddresses>
</host>
</service>
</services>
</system.serviceModel>
And instantiate with the code below:
ServiceHost wcfHost = new ServiceHost(typeof(MyClass));
wcfHost.Open();
Using QuickWatch checked it out and verified the configuration values. Then, I added Service Reference on "net.tcp://localhost:8732/Design_Time_Addresses/MyService/MyClass" to an other project. So, the new config file below has been created in the client project.
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="NetTcpBinding_IMyClass" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
hostNameComparisonMode="StrongWildcard" listenBacklog="10"
maxBufferPoolSize="524288" maxBufferSize="65536" maxConnections="10"
maxReceivedMessageSize="65536">
<readerQuotas maxDepth="32" maxStringContentLength="8192"
maxArrayLength="16384" maxBytesPerRead="4096"
maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />
<security mode="None">
<transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
<message clientCredentialType="Windows" />
</security>
</binding>
</netTcpBinding>
</bindings>
<client>
<endpoint address="net.tcp://localhost:8732/Design_Time_Addresses/MyService/MyClass" binding="netTcpBinding" bindingConfiguration="NetTcpBinding_IMyClass" contract="IMyClass" name="NetTcpBinding_IMyClass">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</client>
</system.serviceModel>
The problem is the binding configuration of host can't come to client. If I change client configuration it doesn't affects. For example, changed maxStringContentLength value from 8192 to 2147483647, then, saw that client has been instantiated with correct config but, operated with old config. Searched "8192" in solution and found in .svcinfo files as XML scheme. How can I solve this weird situation?
Right click the service reference and "Update" the it and VS will regenerate the svcinfo files, or you could avoid this issue entirely by not using VS to create the service proxy and instead generating your own service proxy by hand (considered a best practice as far as I know). As you already noted, "Add Service Reference" is not smart enough to take all those configuration values from the service when creating a client.

WCF AllowNTLM .net 3.5sp1 and IIS7.5

I am getting the following error using WCF, calling the a WCF Service on another server.
An error (The request was canceled)
occurred while transmitting data over
the HTTP channel.
The following Services worked on a IIS7 Box on .net3, but we have recently upgraded to IIS7.5 and .net 3.5sp1, if I remove the AllowNtlm attribute out of the Config, the call gets further but does not pass allow the service to do a double hop to the database, i then get the follow error.
'NT AUTHORITY\ANONYMOUS LOGON'.
I have enclosed a copy of the client app.config, which worked using iis7, but
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="Windows">
<clientCredentials>
<windows allowNtlm="false" allowedImpersonationLevel="Delegation"/>
</clientCredentials>
<dataContractSerializer maxItemsInObjectGraph="4194304"></dataContractSerializer>
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding allowCookies="false" bypassProxyOnLocal="false" closeTimeout="00:01:00" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxBufferSize="4194304" maxReceivedMessageSize="4194304" messageEncoding="Text" name="BasicHttpBinding_CalculationWebService" openTimeout="00:01:00" receiveTimeout="00:30:00" sendTimeout="00:10:00" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
<readerQuotas maxArrayLength="16384" maxBytesPerRead="4096" maxDepth="32" maxNameTableCharCount="16384" maxStringContentLength="8192"></readerQuotas>
<security mode="TransportCredentialOnly">
<message algorithmSuite="Default" clientCredentialType="UserName"></message>
<transport clientCredentialType="Windows" proxyCredentialType="None" realm=""></transport>
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://server1.domain/WebServices/CacheManagement/CacheBusinessService.svc" behaviorConfiguration="Windows" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_CacheWebService" contract="CacheWCFService.CacheWebService" name="BasicHttpBinding_CacheWebService">
<identity>
<servicePrincipalName value="http/server1.domain"></servicePrincipalName>
</identity>
</endpoint>
</client>
</system.serviceModel>
</configuration>
This is the Server Config, any ideas?
<?xml version="1.0"?>
<configuration>
<system.serviceModel>
<services>
<service behaviorConfiguration="CacheManagementBehavior" name="Iris.WebServices.CacheManagement.CacheWebService">
<endpoint address="" behaviorConfiguration="" binding="basicHttpBinding"
bindingConfiguration="basicHttpBinding_CacheManagement" contract="Iris.WebServices.CacheManagement.CacheWebService" />
<endpoint address="mex" behaviorConfiguration="" binding="basicHttpBinding"
bindingConfiguration="basicHttpBinding_CacheManagement" contract="IMetadataExchange" />
</service>
</services>
<bindings>
<basicHttpBinding>
<binding name="basicHttpBinding_CacheManagement" maxReceivedMessageSize="4194304" receiveTimeout="00:30:00">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows"/>
<message clientCredentialType="UserName"/>
</security>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="CacheManagementBehavior">
<dataContractSerializer maxItemsInObjectGraph="4194304" ignoreExtensionDataObject="True"/>
<serviceMetadata httpGetEnabled="True"/>
<serviceDebug httpHelpPageEnabled="true" includeExceptionDetailInFaults="true"/>
<serviceAuthorization impersonateCallerForAllOperations="true"/>
</behavior>a
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
We managed to resolve the issue, by removing ServicePrincipleName from the config
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="Windows">
<clientCredentials>
<windows allowNtlm="false" allowedImpersonationLevel="Delegation"/>
</clientCredentials>
<dataContractSerializer maxItemsInObjectGraph="4194304"></dataContractSerializer>
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding allowCookies="false" bypassProxyOnLocal="false" closeTimeout="00:01:00" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxBufferSize="4194304" maxReceivedMessageSize="4194304" messageEncoding="Text" name="BasicHttpBinding_CalculationWebService" openTimeout="00:01:00" receiveTimeout="00:30:00" sendTimeout="00:10:00" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
<readerQuotas maxArrayLength="16384" maxBytesPerRead="4096" maxDepth="32" maxNameTableCharCount="16384" maxStringContentLength="8192"></readerQuotas>
<security mode="TransportCredentialOnly">
<message algorithmSuite="Default" clientCredentialType="UserName"></message>
<transport clientCredentialType="Windows" proxyCredentialType="None" realm=""></transport>
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://server1.domain/WebServices/CacheManagement/CacheBusinessService.svc" behaviorConfiguration="Windows" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_CacheWebService" contract="CacheWCFService.CacheWebService" name="BasicHttpBinding_CacheWebService" />
</client>
</system.serviceModel>
</configuration>

Wcf service configuration issue

I am getting an issue with WCF service I have created. Issue is not coming on all clients - i.e. on some systems it is working others not.
Error 1:
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.
Error 2:
On some system the operation contract is not exposed properly. A red symbol is coming across operation contract. And unable to call it using wcftestclient.
Config File:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="basicHttpBinding" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647" >
<readerQuotas maxArrayLength="2147483647" maxStringContentLength="2147483647" />
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="ExternalService.Service.MyDashboardService">
<host>
<baseAddresses>
<add baseAddress = "http://****/ExternalService.Service/MyDashboardService/" />
</baseAddresses>
</host>
<!-- Service Endpoints -->
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="basicHttpBinding" contract="ExternalService.ServiceInterface.IMyDashboardService">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
Now the client config I am getting in wcftestclient for Error 1:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IMyDashboardService" />
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://****/ExternalService.Service/MyDashboardService/"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IMyDashboardService"
contract="IMyDashboardService" name="BasicHttpBinding_IMyDashboardService" />
</client>
</system.serviceModel>
</configuration>
Client Config when service is working:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IMyDashboardService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
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>
</bindings>
<client>
<endpoint address="http://****/ExternalService.Service/MyDashboardService/"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IMyDashboardService"
contract="IMyDashboardService" name="BasicHttpBinding_IMyDashboardService" />
</client>
</system.serviceModel>
</configuration>
Please suggest what could be the reason for different behavior of service on different machines.
you should use same bindingConfiguration on both sides clients and service