Why *does* this work, and when will it *not* work? (Two-way MSMQ messaging using WCF)
-
I've been experimenting with various implementations of two-way communications using WCF over MSMQ, and without ever thinking it would work, tried the following:
using System;
using System.ServiceModel;namespace MessagingSample
{
[ServiceContract]
public interface ISampleContract
{
[OperationContract(IsOneWay = true)]
void StartDoingSomething(string someText, SampleClient client);
}\[ServiceBehavior\] public class SampleClient { private ISampleContract workerService; public void StartClient(string server) { // Init the service instance EndpointAddress endpointAddress = new EndpointAddress( new Uri(string.Format(@"net.msmq://{0}/private/SampleQueue", server))); NetMsmqBinding clientBinding = new NetMsmqBinding(); clientBinding.Security.Transport.MsmqAuthenticationMode = MsmqAuthenticationMode.None; clientBinding.Security.Transport.MsmqProtectionLevel = System.Net.Security.ProtectionLevel.None; ChannelFactory<ISampleContract> channelFactory = new ChannelFactory<ISampleContract>(clientBinding, endpointAddress); workerService = channelFactory.CreateChannel(); } public void StopClient() { if (workerService != null) { workerService = null; } } public void StartDoingSomething(string text) { if (workerService != null) { workerService.StartDoingSomething(text, this); } } public void DoSomethingElse(string text) { System.Diagnostics.Debug.WriteLine(text); } } \[ServiceBehavior\] public class SampleServer : ISampleContract { private ServiceHost serviceHost = null; public void StartServer(string server) { Uri serviceUri = new Uri(string.Format(@"net.msmq://{0}/private/SampleQueue", server)); NetMsmqBinding serviceBinding = new NetMsmqBinding(); serviceBinding.Security.Transport.MsmqAuthenticationMode = MsmqAuthenticationMode.None; serviceBinding.Security.Transport.MsmqProtectionLevel = System.Net.Security.ProtectionLevel.None; serviceBinding.MaxReceivedMessageSize = 1024 \* 4096; serviceBinding.ReaderQuotas.MaxArrayLength = 1024 \* 4096;
-
I've been experimenting with various implementations of two-way communications using WCF over MSMQ, and without ever thinking it would work, tried the following:
using System;
using System.ServiceModel;namespace MessagingSample
{
[ServiceContract]
public interface ISampleContract
{
[OperationContract(IsOneWay = true)]
void StartDoingSomething(string someText, SampleClient client);
}\[ServiceBehavior\] public class SampleClient { private ISampleContract workerService; public void StartClient(string server) { // Init the service instance EndpointAddress endpointAddress = new EndpointAddress( new Uri(string.Format(@"net.msmq://{0}/private/SampleQueue", server))); NetMsmqBinding clientBinding = new NetMsmqBinding(); clientBinding.Security.Transport.MsmqAuthenticationMode = MsmqAuthenticationMode.None; clientBinding.Security.Transport.MsmqProtectionLevel = System.Net.Security.ProtectionLevel.None; ChannelFactory<ISampleContract> channelFactory = new ChannelFactory<ISampleContract>(clientBinding, endpointAddress); workerService = channelFactory.CreateChannel(); } public void StopClient() { if (workerService != null) { workerService = null; } } public void StartDoingSomething(string text) { if (workerService != null) { workerService.StartDoingSomething(text, this); } } public void DoSomethingElse(string text) { System.Diagnostics.Debug.WriteLine(text); } } \[ServiceBehavior\] public class SampleServer : ISampleContract { private ServiceHost serviceHost = null; public void StartServer(string server) { Uri serviceUri = new Uri(string.Format(@"net.msmq://{0}/private/SampleQueue", server)); NetMsmqBinding serviceBinding = new NetMsmqBinding(); serviceBinding.Security.Transport.MsmqAuthenticationMode = MsmqAuthenticationMode.None; serviceBinding.Security.Transport.MsmqProtectionLevel = System.Net.Security.ProtectionLevel.None; serviceBinding.MaxReceivedMessageSize = 1024 \* 4096; serviceBinding.ReaderQuotas.MaxArrayLength = 1024 \* 4096;
Try coding it in Java. C# sucks big time. May Allah give you the knowledge
-
Try coding it in Java. C# sucks big time. May Allah give you the knowledge
-
The operative word there being try, of course. P.S. Do you always submit message board posts that make you sound like a total moron, or was this just an isolated instance?
Furty wrote:
Do you always submit message board posts that make you sound like a total moron, or was this just an isolated instance?
Dude i was showing u the right path for programming
-
Furty wrote:
Do you always submit message board posts that make you sound like a total moron, or was this just an isolated instance?
Dude i was showing u the right path for programming
-
Meer Osman Ali wrote:
Dude i was showing u the right path for programming
Right. Gotcha. I had you pegged as a trolling wanker, but thanks for the confirmation!
Furty wrote:
I had you pegged as a trolling wanker, but thanks for the confirmation!
:-D Gee have a nice day then
-
Try coding it in Java. C# sucks big time. May Allah give you the knowledge
Allah has given us C#. Java is an abomination to Allah, a heretic language. Are you rally suggesting that we ignore the progress that He has granted us? Ignore type-safety? Drop the increased productivity? That sounds like the arrogance that Iblis would display :omg: As Spock would say, "Live long and prosper" :-D
-
The operative word there being try, of course. P.S. Do you always submit message board posts that make you sound like a total moron, or was this just an isolated instance?
No, pretty much every post he's made is from a completely ignorant viewpoint.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008 -
Meer Osman Ali wrote:
Dude i was showing u the right path for programming
Right. Gotcha. I had you pegged as a trolling wanker, but thanks for the confirmation!
If it farts like a troll, smells like a troll, and looks like a troll, shouldn't we just castrate it?
Deja View - the feeling that you've seen this post before.
-
If it farts like a troll, smells like a troll, and looks like a troll, shouldn't we just castrate it?
Deja View - the feeling that you've seen this post before.
Absolutely not. It would fart, smell and look like a troll even more, and scream its heart out on top of that. On the other hand, if it intends to procreate, you would have to accept these short-term disadvantages, and go for the long-term benefits. Or act a little more effectively and solve the problem once and forever. :) PS: nothing much has changed around here, has it?
Luc Pattyn [Forum Guidelines] [My Articles]
Fixturized forever. :confused:
-
Absolutely not. It would fart, smell and look like a troll even more, and scream its heart out on top of that. On the other hand, if it intends to procreate, you would have to accept these short-term disadvantages, and go for the long-term benefits. Or act a little more effectively and solve the problem once and forever. :) PS: nothing much has changed around here, has it?
Luc Pattyn [Forum Guidelines] [My Articles]
Fixturized forever. :confused:
Luc Pattyn wrote:
PS: nothing much has changed around here, has it?
Same ol', same ol'. Mind you, I've spent the last month or so working on a bit of Open Source work along with Karl Shifflett, so I've spent less time in the forums as a result.
Deja View - the feeling that you've seen this post before.