Reliability in WCF Polling Duplex Binding - wcf

I have a WCF Polling Duplex Service for silverlight clients. I wanted to add Reliability to the service but first I got this error.
The message version of the outgoing message (Soap11
(http://schemas.xmlsoap.org/soap/envelope/) AddressingNone
(http://schemas.microsoft.com/ws/2005/05/addressing/none)) does not
match that of the encoder (Soap12
(http://www.w3.org/2003/05/soap-envelope) Addressing10
(http://www.w3.org/2005/08/addressing)). Make sure the binding is
configured with the same version as the message.
I changed the config files and I'm now getting the error below. Is reliability supported in WCF Polling Duplex?
Unrecognized element 'reliableSession' in service reference
configuration. Note that only a subset of the Windows Communication
Foundation configuration functionality is available in Silverlight.

I think the problem isn't the usage of WCF polling duplex, but Silverlight in general. It supports only a subset of WCF and according to this article reliable sessions are not supported. A quotation:
"More advanced bindings and binding elements, such as the ones dealing with queues, reliable sessions, transactions, message-level security (such as WS-Security), peer-to-peer messaging, and transports other than HTTP, HTTPS, and TCP are not provided in Silverlight 4."

Related

MSMQ to WCF - automatic notification

I have an application that places messages on MSMQ, than I have a WCF service that I want to automatically read these messages from MSMQ.
I do not want to trigger my WCF service but I want it to be notified whenever a message is pushed on MSMQ. I have found some stuff related to WAS and netMSMQBinding, but the details seems a little unclear about automatic notifications from MSMQ to WCF.
Any help/direction in this regard? Thanks.
What is it that you're trying to achieve?
There is really no such thing as "be notified when a message is pushed on MSMQ". MSMQ uses a pull model to retrieve messages from a queue, so there always needs to exist some kind of "listener" that reads messages from the queue and processes them.
In this case, this "listener" is provided by the WCF NetMsmq or MsmqIntegration bindings automatically, so the programming model for a WCF service that is exposed over MSMQ is just like that of a regular one-way service.
As you state, you can either host that WCF service using your own custom host (such as a Windows service), or, in many cases, the preferred method will be to host that service in IIS 7.X/8.X through WAS.
The following sample shows how to host an MSMQ service in WAS: http://msdn.microsoft.com/en-us/library/ms752246(v=vs.110).aspx
Notice that you do need some specific configuration in IIS to be able to host non-HTTP services, which includes enabling the "Non-HTTP Service Activation" feature. The following articles will be useful to get this done:
http://blogs.msdn.com/b/tomholl/archive/2008/07/12/msmq-wcf-and-iis-getting-them-to-play-nice-part-1.aspx
http://blogs.msdn.com/b/tomholl/archive/2008/07/13/msmq-wcf-and-iis-getting-them-to-play-nice-part-2.aspx
http://blogs.msdn.com/b/tomholl/archive/2008/07/14/msmq-wcf-and-iis-getting-them-to-play-nice-part-3.aspx
http://blogs.msdn.com/b/tomholl/archive/2008/05/17/building-a-pub-sub-message-bus-with-wcf-and-msmq.aspx

Scenarios that can be implemented by WCF only but not with Web API

I've read a couple of articles recently suggesting that Web API can replace WCF; however on the other side some people still defending WCF by saying that it still has its usages.
My question is what are the scenarios where WCF is a must and you have no way of implementing them using Web API?
Basically whenever you need a transport layer other than http webapi cannot be used. For example communication via Message Queues, Inter Process Communication (NamedPipe), direct TCP Socket connections.
WebAPI does not have Peer2Peer Communication, Bi-Directional communication, Reliable Messaging, Transaction Flows, Message Level Security, …

Advantages of using Azure Service Bus Queues with WCF

What are the advantages of using Service bus queue with WCF? Why can't we use QueueClient to access the queue rather than consuming it with WCF services?
I was using message queue with WCF in one of my application rather than use the paint queue client (I'm using RabbitMQ in local). Some reasons from my team's perspective
1, We have been using WCF over net.tcp for our application. In order to improve the performance and scalability we decided to use RabbitMQ. With WCF wrapped we don't need to update the whole system code, just change the WCF transport extension and configuration.
2, We can leverage WCF channel stack mode, switch security settings, message encoding, etc. We need to build our own if use plaint queue client.
3, We can leverage the message exchange patterns WCF provides.
4, It's very easy to extend and customize WCF so that we can add/replace modules we need.
Basically we want to use WCF architecture ranter than design and implement by ourselves.
Hope this helps a bit.

Intercepting WCF calls in thick clients that uses nettcpbinding? is it possible and how?

Considering the following scenario,
I have a thick client that communicate with server through (Windows communication foundation) WCF using nettcpbinding.
Is there any way to intercept the traffic and/or alter it.
The simplest way to intercept the WCF soap messages for debugging on either the client or service is to turn on the built-in WCF tracing feature. You can configure it to only log soap messages by only adding the <source name="System.ServiceModel.MessageLogging"> element.
If you want programmatic access to the soap message then you can implement the IClientMessageInspector behavior in your client application. This blog post on message inspectors describes how you would implement and configure the IClientMessageInspector.
I don't have an experience doing low-level inspection of TCP packets but you can look at the free WireShark tool to work with TCP packets.

Using Windows Services to process MSMQ messages via WCF

We have a solution where we are picking the messages using Windows Service.
The Windows Service fires every after 2 minutes and retrieves the MSMQ message to pass it to a Web Service.
Can I create a WCF service which will automatically picks up the messages from MSMQ Queue?
Can I avoid Windows Service by using WCF Service if it support auto invocation?
Q1: you can automatically pick up messages from MSMQ, you will need to look into the netmsmqbinding, there are some design considerations that you have to think about though, if you are used to the native MSMQ, you know that you have the ability to peek at the messages. But when you use WCF, you loose that ability to peek. WCF will intercept the messages in MSMQ and you are responsible for keeping your WCF service and the peeking app in synch.
You will also need to look into whether you need transactional or non-transactional queues and you will have to modify your binding based on that.
Q2: You will need to host the WCF service in windows service or in IIS7. if you host in IIS7 look into enabling MSMQ WAS listener
Here is a nice article:
http://blogs.msdn.com/tomholl/archive/2008/07/12/msmq-wcf-and-iis-getting-them-to-play-nice-part-1.aspx
One way to transfer messages from an MSMQ to a web service call is to use a netMsmqBinding service endpoint and a basicHttpBinding client endpoint that support the same contract. The netMsmq service will automatically grab messages from the queue and deserialize them into an object. In your implementation of your netMsmq service, just instantiate your basicHttp client proxy and just call the same method. Basically a pass-through or proxy pattern from the web-service to the MSMQ and vice-versa. In Juval Lowy's "Programming WCF" he calls this pattern the "HTTP Bridge" for queues.