netTcpBinding or wsHttpBinding

2019-02-11 17:19发布

问题:

I have a WCF Service hosted as Windows Service and client is an ASP.Net application consuming WCF Service methods.

In process of implementing security, I am confused over which among netTcpBinding/wsHttpBinding will be suitable for my case.

Most likely all the applications in scene (WCF Service, Windows Service, ASP.Net Website) will be sitting on different servers in our office, thus in an Intranet. ASP.Net website will be accessed by users over Internet.

Though, I can always use wsHttpBinding here, will it be suitable to set the service endpoint using netTcpBinding in my case?

回答1:

Check this out for a comparison of all the different built in bindings:

Configuring System-Provided Bindings - MSDN

As for your case, as long as it's the web server contacting the WCF service and you don't need to provide an endpoint for any external consumers of the service...netTcpBindnig should be up to the job.



回答2:

You can expose your service over more than one binding if you wish, so you could actually use both.

However, if you control both client and service and they both use WCF, netTcpBinding is much faster. Unless you have a firewall between those two, I would choose that.



回答3:

Use netTcpBinding instead wsHttpBinding if you are willing to trade interoperability for performance knowing that you can easily cancel the trade if you are not satisfied with the results (it's a matter of changing config values).



回答4:

Since your WCF Services will be accessed by applications sitting in your office (INTRANET), I would go with netTcpBinding.

In an intranet scenario, it is recommended that you use netTcpBinding unless you have a specific requirement to use other bindings such as wsHttpBinding. By default, netTcpBinding uses binary encoding and transport security, which delivers better performance.

Following URLS will help to get more information

http://msdn.microsoft.com/en-us/library/cc949026.aspx

http://msdn.microsoft.com/en-us/library/ms730879.aspx



回答5:

Since your WCF service is a windows service +1 for netTcpBinding. Hosting netTcpBinding on IIS is difficult.