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

  • Home
  • SEARCH
  • 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 5979503
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:40:06+00:00 2026-05-22T21:40:06+00:00

Basically as the question states, if I make my services asynchronous does that mean

  • 0

Basically as the question states, if I make my services asynchronous does that mean they aren’t interoperable anymore?

  • 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-22T21:40:07+00:00Added an answer on May 22, 2026 at 9:40 pm

    As far as the client is concerned, a sync or an async version of the service are identical (see example below). So the sync/async decision does not affect interoperability.

    public class StackOverflow_6231864_751090
    {
        [ServiceContract(Name = "ITest")]
        public interface ITest
        {
            [OperationContract]
            string Echo(string text);
            [OperationContract]
            int Add(int x, int y);
        }
        [ServiceContract(Name = "ITest")]
        public interface ITestAsync
        {
            [OperationContract(AsyncPattern = true)]
            IAsyncResult BeginEcho(string text, AsyncCallback callback, object state);
            string EndEcho(IAsyncResult ar);
            [OperationContract(AsyncPattern = true)]
            IAsyncResult BeginAdd(int x, int y, AsyncCallback callback, object state);
            int EndAdd(IAsyncResult ar);
        }
        public class Service : ITest
        {
            public string Echo(string text) { return text; }
            public int Add(int x, int y) { return x + y; }
        }
        public class ServiceAsync : ITestAsync
        {
            string Echo(string text) { return text; }
            int Add(int x, int y) { return x + y; }
            public IAsyncResult BeginEcho(string text, AsyncCallback callback, object state)
            {
                Func<string, string> func = Echo;
                return func.BeginInvoke(text, callback, state);
            }
    
            public string EndEcho(IAsyncResult ar)
            {
                Func<string, string> func = (Func<string, string>)((System.Runtime.Remoting.Messaging.AsyncResult)ar).AsyncDelegate;
                return func.EndInvoke(ar);
            }
    
            public IAsyncResult BeginAdd(int x, int y, AsyncCallback callback, object state)
            {
                Func<int, int, int> func = Add;
                return func.BeginInvoke(x, y, callback, state);
            }
    
            public int EndAdd(IAsyncResult ar)
            {
                Func<int, int, int> func = (Func<int, int, int>)((System.Runtime.Remoting.Messaging.AsyncResult)ar).AsyncDelegate;
                return func.EndInvoke(ar);
            }
        }
        public static void Test()
        {
            foreach (bool useAsync in new bool[] { false, true })
            {
                Type contractType = useAsync ? typeof(ITestAsync) : typeof(ITest);
                Type serviceType = useAsync ? typeof(ServiceAsync) : typeof(Service);
                Console.WriteLine("Using {0} service implementation", useAsync ? "Asynchronous" : "Synchronous");
                string baseAddress = "http://" + Environment.MachineName + ":8000/Service";
                ServiceHost host = new ServiceHost(serviceType, new Uri(baseAddress));
                host.AddServiceEndpoint(contractType, new BasicHttpBinding(), "");
                host.Open();
                Console.WriteLine("Host opened");
    
                Console.WriteLine("Using the same client for both services...");
                ChannelFactory<ITest> factory = new ChannelFactory<ITest>(new BasicHttpBinding(), new EndpointAddress(baseAddress));
                ITest proxy = factory.CreateChannel();
                Console.WriteLine(proxy.Echo("Hello"));
                Console.WriteLine(proxy.Add(3, 4));
    
                ((IClientChannel)proxy).Close();
                factory.Close();
    
                host.Close();
    
                Console.WriteLine("Done");
                Console.WriteLine();
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to make a function receive an enum as one of its
My situation is that I have a POST cgi script that generates and returns
I have seen this question asked a few times but I have not seen
EDIT: reworded and simplified question to be consise... In my service layer I have
I'm struggling with how best to combine javascript Classes and jQuery plugins. This question
I have a lot of mod_rewrites in a local .htaccess file which basically follow
I'm having difficulty getting Git to cooperate with my user-defined worktree that exists outside
I've got a long running request on an ASPX page (.NET 3.5) to an
As we all know, strings in .NET are immutable. (Well, not 100% totally immutable
I've been given some strings to work with. Each one represents a data set

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.