Wednesday, 28 September 2011

Steps to Host WCF Service with netTCPBinding in IIS 7.0

Hi


Step1. Add Non-HTTP Activation from Features Wizard.

Step 2. Following services should be enabled for net.tcp

Net.TCP Listener Adapter and Net TCP Port Sharing Service.


Step 3.  IIS should be enabled with net.tcp Binding. Go to IISàright Click à enable binding à add net.tcp with Port No.


Step 4. Go to your WCf Service in IIS, right Click manage applicationà advance settingsà  add net.tcp  in enabled protocols.

Step 5.  In your WCF service web.config file you should have mex endpoint.

Step 6. TCP Port should be enabled for inbound and out bound calls.
Hopes it will help you.


The remote server returned an error: (415) Cannot process the message because the content type 'application/soap+xml; charset=utf-8' In WCF

Hi,

I Created my WCF Service and it was working properly when i was making its service reference in my local machine.

But the problem came when I hosted this WCF Service in the Production Server.
When I was taking its reference in my local machine  I got following error.

The remote server returned an error: (415) Cannot process the message because the content type 'application/soap+xml; charset=utf-8'  In WCF.

I had   <serviceMetadata httpGetEnabled="true"/>   in the web.config. but still I got the error.

I resolved this issues by adding another endpoint 'mex' as below in my web.config.


<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />

after adding above endpoint I got the service reference in my Client Application.

Please try If you face the similar problem.

PS: If this post helps you then please put your comments or mail me at smsaxena19@gmail.com


Happy Coding!

Shailendra Saxena

Monday, 26 September 2011

The server has rejected the client credentials WCF Error NetTCpBinding

Hi,

When I created my WCF Service and Host it on server I found following Error.

“The server has rejected the client credentials”.

I resolved it with following changes.

1. At Server Side in Web.Config i added [<security mode="None"></security>] as example given below.

<netTcpBinding>
        <binding name="netTcpBinding"    maxReceivedMessageSize="2147483647">
          <readerQuotas maxStringContentLength="2147483647" maxArrayLength="22365478"/>
     <security mode="None"></security>
        </binding>
      </netTcpBinding>

2. On Client Side Also in my App.config [<security mode="None"></security>] as example given below.

 <netTcpBinding>
                <binding name="NetTcpBinding_IService1" 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"></security>
                </binding>
            </netTcpBinding>

Good Luck.

Happy Coding.