wsHttpBinding to WCF Service hosted in IIS throughput issue - wcf

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

Related

Binding validation failed because the wshttpbinding does not support reliable sessions over transport security over HTTPS

I have seriously ran into a problem and could not resolve it. I have searched a ton of forums but couldn't find anything matching to resolve my issue.
I have two components. One is a WCF service and the other is a client which is basically a hardware that fetches the information from the web service. The WCF service is hosted over IIS with https. The client was able to hit the service when the SSL certificate was not installed, but after the installation of SSL certificate the machine started giving the error I mentioned in the title of my question.
This is the web.config of my service
`
<system.serviceModel>
<!--<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"
multipleSiteBindingsEnabled="true" />-->
<bindings>
<wsHttpBinding>
<binding name="wshttpbinding" bypassProxyOnLocal="true" receiveTimeout="00:10:00">
<reliableSession inactivityTimeout="23:00:00" enabled="true"/>
<security mode="None">
<transport clientCredentialType="None" />
<message clientCredentialType="None" establishSecurityContext="false" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="Services.ServiceBehavior" name="CJDWebServices.Service">
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="wshttpbinding"
contract="CJDWebServices.IService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost/TxService/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="Services.ServiceBehavior">
<!-- To avoid disclosing metadata information,
set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="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" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
`
And this is the app.config of my application running on the hardware
`
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:25:00" sendTimeout="00:25:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="16384"
maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<reliableSession ordered="true" inactivityTimeout="23:59:00"
enabled="True" />
<security mode="Transport">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true"
establishSecurityContext="true" />
</security>
</binding>
<binding name="WSHttpBinding_IMachineMgmt" closeTimeout="00:02:00"
openTimeout="00:02:00" receiveTimeout="00:25:00" sendTimeout="00:25:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647"
maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<reliableSession ordered="true" inactivityTimeout="23:59:00"
enabled="true" />
<security mode="Transport">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true"
establishSecurityContext="true" />
</security>
</binding>
<binding name="WSHttpBinding_IPM" closeTimeout="00:02:00" openTimeout="00:02:00"
receiveTimeout="00:05:00" sendTimeout="00:05:00" bypassProxyOnLocal="false"
transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647"
maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="true" />
<security mode="Transport">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true"
establishSecurityContext="true" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="https://dummy1/dummy1/dummy1.svc" binding="wsHttpBinding" <!-- This is the one causing trouble --!>
bindingConfiguration="WSHttpBinding_IService" contract="IService"
name="WSHttpBinding_IService">
<identity>
<dns value="dummy1" />
</identity>
</endpoint>
<endpoint address="https://dummy2/dummy2/dummy2.asmx" binding="wsHttpBinding"
bindingConfiguration="WSHttpBinding_IMachineMgmt"
contract="MonService.IMachineMgmt" name="WSHttpBinding_IMachineMgmt">
<identity>
<dns value="dummy2" />
</identity>
</endpoint>
<endpoint address="https://dummy3/dummy3/" binding="wsHttpBinding"
bindingConfiguration="WSHttpBinding_IPM" contract="IPM" name="WSHttpBinding_IPM">
<identity>
<dns value="dummy3" />
</identity>
</endpoint>
</client>
</system.serviceModel>
<appSettings>
<empty here>
</appSettings>
</configuration>
`
The service mentioned below is my pain area
<endpoint address="https://dummy1/dummy1/dummy1.svc" binding="wsHttpBinding" <!-- This is the one causing trouble --!>
bindingConfiguration="WSHttpBinding_IService" contract="IService"
name="WSHttpBinding_IService">
<identity>
<dns value="dummy1" />
</identity>
</endpoint>
I have tried playing around with changing the security mode from none to transport and vice versa, but no luck. I even tried it on the web service configuration file but still no luck.
The service is accessible on the machine by the URL if I browse it on the browser
In response to your problem, I propose the following two solutions:
1.First of all, in the MSDN post there is an example of using wshttpbinding transport, accompanied by the corresponding code, you can learn about it.
Here is the web.config on its server side:
<system.serviceModel>
<protocolMapping>
<add scheme="https" binding="wsHttpBinding" />
</protocolMapping>
<bindings>
<wsHttpBinding>
<!-- configure wsHttp binding with Transport security mode and clientCredentialType as None -->
<binding>
<security mode="Transport">
<transport clientCredentialType="None"/>
</security>
</binding>
</wsHttpBinding>
</bindings>
<!--For debugging purposes set the includeExceptionDetailInFaults attribute to true-->
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To expose metadata over a secure transport uncomment the serviceMetadata behavior
and the mex endpoint above
Note: you must have a valid certificate for svcutil to work -->
<!--<serviceMetadata httpsGetEnabled="True"/>-->
<serviceDebug includeExceptionDetailInFaults="False" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
Here is the app.config on its client side:
<system.serviceModel>
<client>
<!-- this endpoint has an https: address -->
<endpoint address="https://localhost/servicemodelsamples/service.svc" binding="wsHttpBinding" bindingConfiguration="Binding1" contract="Microsoft.Samples.TransportSecurity.ICalculator"/>
</client>
<bindings>
<wsHttpBinding>
<!-- configure wsHttpbinding with Transport security mode
and clientCredentialType as None -->
<binding name="Binding1">
<security mode="Transport">
<transport clientCredentialType="None"/>
</security>
</binding>
</wsHttpBinding>
</bindings>
</system.serviceModel>
2.Finally, you can try to use custom bindings:
wcf custom bindings

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 charset=utf-8 of the response message does not match the content type of the binding (application/soap+xml; charset=utf-8)

I'm hosting a WCF service in IIS 7.5 using .NET 4.0. I also have a WPF application that I am using as my client that was built with Visual Studio 2010 and .NET 4.0. I added my service reference and when I attempt to call a function, I get the following exception
The content type application/xml; charset=utf-8 of the response message does not match the content type of the binding (application/soap+xml; charset=utf-8)
I am able to navigate to the service in a web browser and my bindings appear to be the same between the client and service (WsHttp bindings).
I know there are alot of google results about this error but none of them seemed to be relevant/help my specific problem. I tried installing Non-HTTP Activation features as well as a wide variety of other small tricks. Anybody be able to help? Thanks
edit, here are my configs (they are quite lengthy)
Client
<?xml version="1.0"?>
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="ContentSoap"
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="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192"
maxArrayLength="2147483647"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
<binding name="OrderSoap"
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>
<netTcpBinding>
<binding name="NetTcpBindingEndpoint" 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="2147000000" maxBufferSize="65536" maxConnections="10"
maxReceivedMessageSize="2147000000">
<readerQuotas maxDepth="32" maxStringContentLength="8192"
maxArrayLength="2147000000" maxBytesPerRead="4096"
maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:01:00"
enabled="true" />
<security mode="None">
<transport clientCredentialType="Windows"
protectionLevel="EncryptAndSign" />
<message clientCredentialType="Windows" />
</security>
</binding>
</netTcpBinding>
<wsHttpBinding>
<binding name="WSHttpBinding_IInmateCanteenServiceWeb"
closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false"
hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192"
maxArrayLength="16384" maxBytesPerRead="4096"
maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="Transport">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint name="ContentSoap"
address="http://media.team.twvending.net/storeservices/content.asmx"
binding="basicHttpBinding" bindingConfiguration="ContentSoap"
contract="MediaPortContent.ContentSoap" />
<endpoint name="OrderSoap"
address="http://media.team.twvending.net/storeservices/order.asmx"
binding="basicHttpBinding" bindingConfiguration="OrderSoap"
contract="MediaPortOrder.OrderSoap" />
<endpoint name="NetTcpBindingEndpoint"
address="..."
binding="netTcpBinding" bindingConfiguration="NetTcpBindingEndpoint"
contract="WebCallBack.ICallbackService" />
<endpoint name="WSHttpBinding_IInmateCanteenServiceWeb"
address="..."
binding="wsHttpBinding"
bindingConfiguration="WSHttpBinding_IInmateCanteenServiceWeb"
contract="InmateCanteenWeb.IInmateCanteenServiceWeb" />
<endpoint name="WSHttpBinding_ICommAccountingBinding"
address="..."
binding="wsHttpBinding"
bindingConfiguration="WSHttpBinding_IInmateCanteenServiceWeb"
contract="CommAccountingWeb.ICommAccountingWeb" />
</client>
</system.serviceModel>
and Server
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="httpBehavior">
<!--<webHttp />-->
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceCredentials>
<clientCertificate>
<authentication revocationMode="NoCheck" />
</clientCertificate>
<serviceCertificate findValue="CN=secure.inmatecanteen.com" />
</serviceCredentials>
<serviceMetadata httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
<behavior name="MexBehavior">
<serviceMetadata httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
<behavior name="HttpMexBehavior">
<serviceMetadata httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
<behavior name="BasicHttpMexBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
<behavior name="">
<serviceMetadata httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="false"
multipleSiteBindingsEnabled="true" />
<bindings>
<wsHttpBinding>
<binding name="myWsHttpBinding" maxBufferPoolSize="2147483647"
maxReceivedMessageSize="2147483647" messageEncoding="Text">
<readerQuotas maxDepth="32" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647" />
<security mode="Transport">
<transport clientCredentialType="None" />
</security>
</binding>
</wsHttpBinding>
<webHttpBinding>
<binding name="myWebHttpBinding">
<security mode="Transport">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
</security>
</binding>
</webHttpBinding>
<basicHttpBinding>
<binding name="myBasicHttpBinding" maxBufferPoolSize="2147483647"
maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="32" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647" />
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="CommAccountingWeb.CommAccountingWeb"
behaviorConfiguration="HttpMexBehavior">
<endpoint
address=""
behaviorConfiguration="httpBehavior"
binding="webHttpBinding" bindingConfiguration="myWebHttpBinding"
contract="CommAccountingWeb.ICommAccountingWeb" />
<endpoint
address="mex"
binding="mexHttpsBinding"
contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="..."></add>
</baseAddresses>
</host>
</service>
<service name="CommAccountingWeb.CommAccountingBasic"
behaviorConfiguration="BasicHttpMexBehavior">
<endpoint
address=""
binding="basicHttpBinding"
bindingConfiguration="myBasicHttpBinding"
contract="CommAccountingWeb.ICommAccountingBasic" />
<endpoint
address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="..." />
</baseAddresses>
</host>
</service>
</services>
</system.serviceModel>
As I suspected - your client-side config looks like this:
<endpoint name="WSHttpBinding_ICommAccountingBinding"
address="https://secure.inmatecanteen.com/CommAccountingService/CommAccountingWeb.svc"
binding="wsHttpBinding"
bindingConfiguration="WSHttpBinding_IInmateCanteenServiceWeb"
contract="CommAccountingWeb.ICommAccountingWeb" />
It expects wsHttpBinding - but the server-side address it's connecting to is:
<service name="CommAccountingWeb.CommAccountingWeb"
behaviorConfiguration="HttpMexBehavior">
<endpoint
address=""
behaviorConfiguration="httpBehavior"
binding="webHttpBinding" bindingConfiguration="myWebHttpBinding"
contract="CommAccountingWeb.ICommAccountingWeb" />
<host>
<baseAddresses>
<add baseAddress="https://secure.inmatecanteen.com/CommAccountingService/CommAccountingWeb.svc"></add>
</baseAddresses>
</host>
</service>
and this server endpoint uses webHttpBinding.
So while the client expects a SOAP XML message (content type: application/soap+xml; charset=utf-8), the server-side endpoint is a REST endpoint which returns plain XML (content type: application/xml; charset=utf-8)
Solution: you need to make sure both the client and the server endpoint used are in sync with regards to bindings and configuration!
As Steven Westbrook says in a comment on this answer:
Add ?wsdl to your client's endpoint address, and you should have more luck with the service. ?wsdl is important - it means the browser is just getting "Web Services Description Language" for the service, and not calling the service.
I had the same issue and adding ?wsdl solved my headache.
I came across a similar error while creating a client service to one of the existing server side WebService. I could rectify it using SOAP 1.1 transport protocol on the client. Somehow soap 1.2 is giving/expecting a different format. This trace back to the difference between BasicHttpBinding vs WebHttpBinding vs WsHttpBinding.
I got this problem after I added a method that returned a collection of instances of a base class that didn't have a [KnownType] attribute that would resolve to a concrete instance.
With the [KnownType] attribute in place the problem disappeared.
[ServiceContract]
public interface IService {
[OperationContract]
IEnumerable<ItemBase> GetItems();
}
[DataContract]
// [KnownType(typeof(RealItemA))] <--- without these attributes you will get a problem
// [KnownType(typeof(RealItemB))]
public class ItemBase {
}
[DataContract]
public class RealItemA : ItemBase {
}
[DataContract]
public class RealItemB : ITemBase {
}
in my case same error was caused by missing
[datacontract]
[datamember]
attributes in returned data type.
Error message was really misleading.
In my case a specific service was using SOAP 1.1 instead of the usual 1.2.
I had to change the binding from this:
<system.serviceModel>
<bindings>
<customBinding>
<binding name="ServiceSoapBinding">
<textMessageEncoding messageVersion="Soap12"/>
</binding>
</customBinding>
</bindings>
</system.serviceModel>
To this:
<system.serviceModel>
<bindings>
<customBinding>
<binding name="ServiceSoapBinding">
<textMessageEncoding messageVersion="Soap11"/>
</binding>
</customBinding>
</bindings>
</system.serviceModel>

WCF configuration netTCp , Endpoint is null

I am getting the following error
"The Address property on
ChannelFactory.Endpoint was null. The
ChannelFactory's Endpoint must have a
valid Address specified."
and I am not sure what I am doing wrong. Does anybody see know what is the reson of it? Below are my project's App.config Server and Client Side
Thank you for help, regards
<system.serviceModel>
<services>
<service name="Server.DualService" behaviorConfiguration="NetTcpBehavior">
<endpoint address=""
binding="netTcpBinding"
bindingConfiguration="DuplexBinding"
contract="Server.IDualService" />
<endpoint address="mex" binding="mexTcpBinding" contract="Server.IDualService" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:8731/Service/DualService/" />
</baseAddresses>
</host>
</service>
<service name="Server.PhoneService" behaviorConfiguration="Server.PhoneServiceBehavior">
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="" contract="Server.IPhoneService" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:4444/Service/PhoneService" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="Server.DualServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
<behavior name="Server.PhoneServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
<behavior name="NetTcpBehavior">
<serviceThrottling maxConcurrentSessions="10000" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<netTcpBinding>
<binding name="DuplexBinding" sendTimeout="00:00:11">
<reliableSession enabled="true" />
<security mode="None" />
</binding>
</netTcpBinding>
</bindings>
</system.serviceModel>
CLIENT SIDE
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="DefaultBinding_IPhoneService" 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="">
<extendedProtectionPolicy policyEnforcement="Never" />
</transport>
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
<binding name="DefaultBinding_IDualService" 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="">
<extendedProtectionPolicy policyEnforcement="Never" />
</transport>
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
<wsHttpBinding>
<binding name="WSHttpBinding_IPhoneService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="Message">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="">
<extendedProtectionPolicy policyEnforcement="Never" />
</transport>
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" establishSecurityContext="true" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint binding="basicHttpBinding" bindingConfiguration="DefaultBinding_IPhoneService"
contract="IPhoneService" name="DefaultBinding_IPhoneService_IPhoneService" />
<endpoint binding="basicHttpBinding" bindingConfiguration="DefaultBinding_IDualService"
contract="IDualService" name="DefaultBinding_IDualService_IDualService" />
<endpoint address="http://localhost:4444/Service/PhoneService"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IPhoneService"
contract="ServiceReference2.IPhoneService" name="WSHttpBinding_IPhoneService">
<identity>
<userPrincipalName value="PANDZIA-PC\PANDZIA" />
</identity>
</endpoint>
</client>
</system.serviceModel>
There is some problem with your configuration. Server specifies DualService over net.tcp but client uses BasicHttpBinding and does not specify address. Also your client has configuration for more endpoint then your service expose and mex endpoint in DualService has incorrect contract (should be IMetadataExchange).
Only client endpoint for PhoneService looks correct.
Everything works, you were right :),Thank you once again , and below I am putting the correct configuration, maybe someday it will help to somebody, .. :D:D
On server side I ve corrected IMetadataExchange in endpoint :
<endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange" />
and I changed alittle
<behavior name="NetTcpBehavior">
<serviceMetadata/>
<serviceThrottling maxConcurrentSessions="10000" />
</behavior>
On CLIENT SIDE I deleted most genereted code in retation with DualService and added
<endpoint name=""
address="net.tcp://localhost:8731/Service/DualService/"
binding="netTcpBinding"
bindingConfiguration="DuplexBinding"
contract="IDualService" />
where binding looks like :
<netTcpBinding>
<binding name="DuplexBinding" sendTimeout="00:00:05" >
<reliableSession enabled="true" />
<security mode="None" />
</binding>
</netTcpBinding>

Use wshttpBinding with SSL and wsHttpBinding without SSL in single service

I want to use wshttpbinding (with SSL and without SSL) in single service but it not works, anybody had implemented it. So please guide how can i achieve that?
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="CommonBehaviour">
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
<serviceCredentials>
<serviceCertificate findValue="AzilenTechnology" x509FindType="FindBySubjectName" />
</serviceCredentials>
<serviceDebug includeExceptionDetailInFaults="false" />
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="basicHttpBindingConfig" closeTimeout="00:10:00"
openTimeout="00:10:00" sendTimeout="00:10:00" maxBufferSize="2147483647"
maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
messageEncoding="Mtom">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</binding>
</basicHttpBinding>
<wsHttpBinding>
<binding name="wsHttpBindingConfig" closeTimeout="00:10:00" openTimeout="00:10:00"
sendTimeout="00:10:00" bypassProxyOnLocal="true" maxBufferPoolSize="2147483647"
maxReceivedMessageSize="2147483647" messageEncoding="Mtom">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="None" />
</binding>
</wsHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="CommonBehaviour" name="wcfAllInOne.wcfFileIO">
<endpoint binding="mexHttpBinding" bindingConfiguration="" contract="IMetadataExchange" />
<endpoint address="http://localhost:82/WCFAllInOne/wcfFileIO.svc/basicHttpEndPoint" binding="basicHttpBinding"
bindingConfiguration="basicHttpBindingConfig" name="BasicHttp"
contract="wcfAllInOne.IwcfFileIO" />
<endpoint address="http://localhost:82/WCFAllInOne/wcfFileIO.svc/wsHttpBindingEndPoint" binding="wsHttpBinding"
bindingConfiguration="wsHttpBindingConfig" name="wsHttp" contract="wcfAllInOne.IwcfFileIO" />
<endpoint address="https://localhost:444/WCFAllInOne/wcfFileIO.svc/wsHttpSslEndPoint" binding="wsHttpBinding"
bindingConfiguration="wsHttpBindingConfig" name="wsHttpSsl"
contract="wcfAllInOne.IwcfFileIO" />
<endpoint binding="mexHttpsBinding" bindingConfiguration="" contract="IMetadataExchange" />
</service>
</services>
I found the solution, why my last configuration doesn't work,
My first mistake is that i used same configuration for wsHttpBinding with ssl and wsHttpBinding Without SSL
Here in my config file,i had just created only one "wsHttpBindingConfig" for both endpoint (one has http address and another one has https address),
Now i am using two different configuration for to solve this problem.
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="CommonBehaviour">
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
<serviceCredentials>
<serviceCertificate findValue="AzilenTechnologies" x509FindType="FindBySubjectName" />
</serviceCredentials>
<serviceDebug includeExceptionDetailInFaults="false" />
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="basicHttpBindingConfig" closeTimeout="00:10:00"
openTimeout="00:10:00" sendTimeout="00:10:00" maxBufferSize="2147483647"
maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
messageEncoding="Mtom">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security>
<transport>
<extendedProtectionPolicy policyEnforcement="Never" />
</transport>
</security>
</binding>
</basicHttpBinding>
<wsHttpBinding>
<binding name="wsHttpsBindingConfig" closeTimeout="00:10:00"
openTimeout="00:10:00" sendTimeout="00:10:00" bypassProxyOnLocal="true"
maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
messageEncoding="Mtom">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="Transport">
<transport clientCredentialType="None">
<extendedProtectionPolicy policyEnforcement="Never" />
</transport>
</security>
</binding>
<binding name="wsHttpBindingConfig" 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" maxNameTableCharCount="2147483647" />
<security>
<transport>
<extendedProtectionPolicy policyEnforcement="Never" />
</transport>
</security>
</binding>
</wsHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="CommonBehaviour" name="wcfAllInOne.wcfFileIO">
<endpoint binding="mexHttpBinding" bindingConfiguration="" contract="IMetadataExchange" />
<endpoint address="/basicHTTPEndPoint" binding="basicHttpBinding"
bindingConfiguration="basicHttpBindingConfig" name="basicHttp"
contract="wcfAllInOne.IwcfFileIO" />
<endpoint address="/wsHTTPEndPoint" binding="wsHttpBinding" bindingConfiguration="wsHttpBindingConfig"
name="wsHttp" contract="wcfAllInOne.IwcfFileIO" />
<endpoint address="/wsHTTPSEndPoint" binding="wsHttpBinding"
bindingConfiguration="wsHttpsBindingConfig" name="wsHttpSsl"
contract="wcfAllInOne.IwcfFileIO" />
<endpoint binding="mexHttpsBinding" bindingConfiguration="" contract="IMetadataExchange" />
</service>
</services>