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 6753037
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:06:50+00:00 2026-05-26T13:06:50+00:00

I’m running a service which looks like the MS Calculator Example. This is the

  • 0

I’m running a service which looks like the MS Calculator Example.
This is the ServiceContract contract Interface.

[ServiceContract(Namespace = "http://localhost:8000/Calculator")]
public interface ICalculator
{
    [OperationContract]
    double Add(double n1, double n2);
    [OperationContract]
    double Subtract(double n1, double n2);
    [OperationContract]
    double Multiply(double n1, double n2);
    [OperationContract]
    double Divide(double n1, double n2);
}

I set up the Service like this:

public partial class Service1: ServiceBase
{
    private static readonly string sNameOfService = "CalculatorService";
    public static string NameOfService
    {
        get { return sNameOfService; }
    }

    public ServiceHost serviceHost = null;

    public Service1()
    {
        InitializeComponent();

        this.ServiceName = sNameOfService;
        this.CanStop = true;
        this.CanPauseAndContinue = false;
        this.AutoLog = true;
    }

    protected override void OnStart(string[] args)
    {
        if (serviceHost != null)
            serviceHost.Close();

        Uri[] baseAddress = new Uri[]{
      new Uri("net.pipe://localhost")};

        string PipeName = "Calculator";

        serviceHost = new ServiceHost(typeof(CalculatorImplementation), 

        serviceHost.AddServiceEndpoint(typeof(ICalculator), new NetNamedPipeBinding(), PipeName);

        serviceHost.Open();
    }

    protected override void OnStop()
    {
        if (serviceHost != null && serviceHost.State != CommunicationState.Closed)
        {
            serviceHost.Close();
            serviceHost = null;
        }
    }
}

I installed the service successfully and it’s running on my local machine.
The next step was to set up a client, accessing the service which I did in the following way.

public interface ICalculator
{
    // die einzelnen Teile können auch als Vorgänge bzw. Kanäle verstanden werden
    // öffentliche Teile des Interfaces definieren
    // diese werden durch das OperationContract Attribut identifiziert
    [OperationContract]
    double Add(double n1, double n2);
    [OperationContract]
    double Subtract(double n1, double n2);
    [OperationContract]
    double Multiply(double n1, double n2);
    [OperationContract]
    double Divide(double n1, double n2);
}

class Program
{
    static void Main(string[] args)
    {
        ChannelFactory<ICalculator> pipeFactory = new ChannelFactory<ICalculator>(new NetNamedPipeBinding(), new EndpointAddress("net.pipe://localhost/Calculator"));

        ICalculator pipeProxy = pipeFactory.CreateChannel();

        double erg = pipeProxy.Add(5, 6);

        Console.WriteLine("Ergebnis: {0}", erg.ToString());
        Console.ReadLine();
    }
}

But i get an ActionNotSupportedException when trying to call “pipeProxy.Add()” and I got no idea why this happens.
Is my server not set up correctly or did I something wrong within the client or did I missed to set some needed attributes? I browsed through multiple examples using named pipes but I found nothing that helped me solving my problem.

Furthermore I was asking myself, what is the difference and where should I use the ServiceHost implementation and the NamedPipeClientStream/NamedPipeServerStream implementation?

  • 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-26T13:06:51+00:00Added an answer on May 26, 2026 at 1:06 pm

    ActionNotSupportedException is thrown when your client uses SOAP action which is unknown to the server. By default names of SOAP actions are inferred from types of service contracts and operation contracts.

    In your example I see the contract defined twice. Does it mean that both service and client has their own definition of ICalculator? In such case without further effort these two contracts are not the same because they most probably sit in different namespaces and your first contract specifies its own namespace whereas the second doesn’t. If you want to use the same interface put it to separate assembly and reference the assembly from both service and client. Otherwise you will have to go through ServiceContract and OperationContract attributes and make sure that values for Namespace, Action and ReplyAction are same in both interfaces.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I would like to run a str_replace or preg_replace which looks for certain words
For some reason, after submitting a string like this Jack’s Spindle from a text
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have some data like this: 1 2 3 4 5 9 2 6
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I would like to count the length of a string with PHP. The string
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
this is what i have right now Drawing an RSS feed into the php,

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.