0

I have a C# Desktop app.

It currently sends JPEGS to my server using WCF calls to my IIS server using basicHttpBinding.

I also use:

messageEncoding="Mtom"

and I use the attibute:

[OperationContract(IsOneWay = true)]

on my Interface to my Method in my WCF.

The maximum number of bytes I upload for each image is never more than 18KBs.

The uploads are as many as I can fit into my calls. They are uploaded sequentially so not to overload the router.

I read the descriptions for using the different Transport ie Basic, TCP, NamePipes.

would the optimum way for me to host a TCP Net binding in a Windows Service {ie outside IIS) or is there going to be no differences to the upload speed?

I am confused...

Andrew Simpson
  • 6,883
  • 11
  • 79
  • 179

3 Answers3

1

A few thoughts to consider:

The Net.Tcp binding is generally considered to be the best performing binding type for communications between different endpoints. The drawbacks are that net.tcp is not interoperable with non-WCF clients and does not work well with load balancing. If your use case avoids those two conditions then you may see a performance benefit with the Net.Tcp binding.

As an alternative, you could also consider binary encoding over HTTP, which has the benefits of a high-performance serializer without the usage limitations of Net.Tcp (interoperability and load balancing complication).

Based on your scenario, you may want to consider the MSMQ binding, which provides a reliable way to submit messages to a service, but it does not send reply messages back to the client. The benefit of this is that clients do not have to wait for the message to be processed to resume execution.

https://msdn.microsoft.com/en-us/library/vstudio/hh323713%28v=vs.100%29.aspx

Additional performance info available in this post:
WCF How much faster is TCP than HTTP

Community
  • 1
  • 1
Seymour
  • 7,043
  • 12
  • 44
  • 51
  • Hi, thanks for your answer. All my clients are wcf and do not require a response back from the server. There will be many clients all uploading images. If I put onto a mama then I would be copying the image twice. Once in the msmq message and the an app to read the queue and save to hard drive. Your comment MAY see a performance boost is not definitive enough. This is the basis of my question. Thanks for the links – Andrew Simpson Mar 03 '15 at 16:09
0

If you are using only in desktop application, then you should use TCP binding.

Rajat_RJT
  • 64
  • 7
  • HI, thanks for your answer. I am not just using Desktop I am uploading to my server. My question was asking things on 2 fronts: 1)whether running outside IIS is quicker and 2). Whether TCP is quicker. Telling me I SHOULD use TCP binding without any explanation does not really help me. But thanks for your time:) – Andrew Simpson Mar 04 '15 at 11:19
  • Yes, you can use self hosting but you will not get the features which IIS provides to services. and about TCP, this article will help you- [tcpVSpipeVSbasic](http://stackoverflow.com/questions/765692/wcf-net-pipe-vs-net-tcp-vs-http-bindings) – Rajat_RJT Mar 05 '15 at 05:56
  • HI, thanks for your time in this. The thing i have explained what my type of service is expected to do. From the information I have given what benefits do i get using IIS then? – Andrew Simpson Mar 05 '15 at 07:55
  • Also, thanks for the link. I have seen it before. Again, it is opinion rather than factual answers. I am still after the WHY – Andrew Simpson Mar 05 '15 at 07:55
0

The most common way to do this is to use streaming.

To transfer large files/any files using “WCF service + HTTP”, we can use the following types of bindings:

  • wsHttpBinding
  • basicHttpBinding

In wsHttpBinding, we can set the transfermode attribute as Buffered, but there is a disadvantage in using this approach for large files, because it needs to put the entire file in memory before uploading/downloading, A large buffer is required on both the web client and the WCF service host. However, this approach is very useful for transferring small files, securely.

In basicHTTPBinding we can use the transfermode as Streamed so that the file can be transferred in the form of chunks.

NetTcpBinding is more useful in terms of security and of course performance but for your case i suggest basicHTTPBinding.

  • Hi, thanks for your comment. I know all this already. My question was the direct comparison between basic and NetTcp streaming. You have just added an opinion right at the end with no actual reason as to why.. – Andrew Simpson Mar 19 '15 at 07:15
  • also, as i stated in my question i am NOT transferring large files. They are 18Kb – Andrew Simpson Mar 19 '15 at 07:16
  • Hi, That is what i am saying. For only file upload/download purpose you can go with basicHTTPBinding and as you said your files are not more than 18Kb then you will get acceptable performance with same but your purpose includes TCP for message delivery and windows security for message and authentication at run time,Supports duplex contracts and transactions and clients are in intranet infrastructure then go with NetTcpBinding because It uses TCP protocol and provides support for security, transaction and reliability. – Aarifmohammad Mansuri Mar 19 '15 at 08:40
  • TCP should be quicker. What is your arguments and logic for why it is not? – Andrew Simpson Mar 19 '15 at 17:47