Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6870849
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:44:00+00:00 2026-05-27T03:44:00+00:00

Maybe I am mixing things, if this is the case, please let me know.

  • 0

Maybe I am mixing things, if this is the case, please let me know.

I want to provide a set of services through WCF regarding messages (this is an example). In this set I am going to have a “sendMessage” service and a “receiveMessage” service.

For the sendMessage, I want to use MSMQ, so the user can send the message to 100.000 other users and this will be processed in background.

For the receiveMessage I do not want to use MSMQ because I want the user to be served when he makes the request and get the response (MSMQ, in this case, is oneway).

I am using this code to start my host in an example application

 static void Main(string[] args)
    {
        using (ServiceHost host =
            new ServiceHost(typeof(Service), new Uri[] { 
                new Uri("net.msmq://localhost/private/loadqueue"), 
                new Uri("http://localhost:8383/") }))
        {
            host.Description.Behaviors.Add(new ServiceMetadataBehavior() { HttpGetEnabled = true });

            NetMsmqBinding binding = new NetMsmqBinding();
            binding.Security.Transport.MsmqAuthenticationMode = MsmqAuthenticationMode.None;
            binding.Security.Transport.MsmqProtectionLevel = System.Net.Security.ProtectionLevel.None;
            binding.ExactlyOnce = false;

            host.AddServiceEndpoint(
                typeof(IContract),
                binding,
                string.Empty);

            host.AddServiceEndpoint(
                typeof(IMetadataExchange),
                MetadataExchangeBindings.CreateMexHttpBinding(),
                "mex");

            host.Open();
            Console.WriteLine("service running");
            Console.ReadLine();

        }
    }

The Contract looks like this

[ServiceContract(SessionMode=SessionMode.Allowed)]
[DeliveryRequirements(QueuedDeliveryRequirements = QueuedDeliveryRequirementsMode.Allowed)]
public interface IContract
{
    [OperationContract(IsOneWay = true)]
    void SendData(string msg);
}

When the client invokes the SendData service, the message is sent to the queue and after that it is consumed by the service.

I would like to create a second service which receives directly the message from the client (no queue in the middle).

The client would have only one web reference and if he calls service.SendData() the message is sent to the queue and if the client calls service.NetMethod() the service receives the message directly. This way it would be transparent for the client side developer if the service is using a queue or not and I would be able to group the services regarding their functions and not mechanisms. Would that be possible to make?

Thanks,
Oscar

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T03:44:01+00:00Added an answer on May 27, 2026 at 3:44 am

    WCF allows you to expose the same service contract across mixed transport bindings. For example, your service class has two operations, one one-way, and one request-response. You can expose this service across net.tcp:// and http:// on two endpoints (with different URIs).

    However, what you want to do is have the different operations on your service contract exposed over different transports, and as far as I know WCF does not allow this.

    The problem you have is that, as you say, the bi-directional operation cannot be supported under the msmq binding. So you would not be able to expose your entire contract across http and msmq simultaneously.

    Is there any reason you cannot define two service contracts and host them in the same servicehost, as described here?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Maybe this cannot be done, but please help or suggest how this can be
Maybe I just don't know .NET well enough yet, but I have yet to
Maybe the need to do this is a 'design smell' but thinking about another
Maybe this is a dumb question, but is there any way to convert a
Maybe I'm just thinking about this too hard, but I'm having a problem figuring
Maybe this applied to other Delphi's (I've only used 7). We've got our code
Maybe this is an overarching question as I've seen similar bugs in Firefox and
Maybe this is a dumb question, but I have the following behavior in Visual
Maybe I'm losing my mind - I thought this was straight forward. ListCode.DataTextField =
maybe this might be a simple problem but after a long while at Google

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.