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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T10:32:58+00:00 2026-06-12T10:32:58+00:00

I used this link to learn WCF programming I used the sample code in

  • 0

I used this link to learn WCF programming

I used the sample code in that link that was for connection between client and server. Now I want to convert that console applications to WPF but I get this error when I run client (of course I run server before running client) :

There was no endpoint listening at net.pipe://localhost/PipeReverse that could accept the message. This
is often caused by an incorrect address or SOAP action.

Also I should say that sample code does not have any app.config file.

In MainWindow.xaml file for client :

[CallbackBehavior( ConcurrencyMode=ConcurrencyMode.Multiple,UseSynchronizationContext=false )]
public partial class MainWindow : Window,ICallbacks
{
    public void MyCallbackFunction(string callbackValue)
    {
        Dispatcher dispatcher=Dispatcher.CurrentDispatcher;
        dispatcher.BeginInvoke( new Action(
        () => textBox1.Text = callbackValue ) );
        //     MessageBox.Show( "Callback Received: {0}",callbackValue );
    }
    IStringReverser _channel;
    [ServiceContract( SessionMode = SessionMode.Required,
    CallbackContract = typeof( ICallbacks ) )]
    public interface IStringReverser
    {
        [OperationContract]
        string ReverseString(string value);
    }


    public MainWindow()
    {
        InitializeComponent();
        MainWindow myCallbacks = this;
        var pipeFactory = new DuplexChannelFactory<IStringReverser>(
           myCallbacks,
           new NetNamedPipeBinding(),
           new EndpointAddress(
              "net.pipe://localhost/PipeReverse" ) );
        ThreadPool.QueueUserWorkItem( new WaitCallback(
            (obj) =>
            {
                _channel = pipeFactory.CreateChannel();
            } ) );
    }

    private void button1_Click(object sender,RoutedEventArgs e)
    {
      _channel.ReverseString( "Hello World" );
    }
}
public interface ICallbacks
{
    [OperationContract( IsOneWay = true )]
    void MyCallbackFunction(string callbackValue);
}

In MainWindow.xaml file for server :

public partial class MainWindow : Window
{
    public MainWindow()
    {
        InitializeComponent();
    }


    private void button1_Click(object sender,RoutedEventArgs e)
    {
        using (ServiceHost host = new ServiceHost(
       typeof( StringReverser ),
        new Uri[]{
      new Uri("net.pipe://localhost")
        } ))
        {
            host.AddServiceEndpoint( typeof( IStringReverser ),
              new NetNamedPipeBinding(),
              "PipeReverse" );

            host.Open();

            MessageBox.Show( Properties.Resources.Service_is_available__Press__ENTER__to_exit_ );
            host.Close();
        }
    }
}

[ServiceContract(SessionMode = SessionMode.Required,
                 CallbackContract = typeof( ICallbacks ) )]
public interface IStringReverser
{
    [OperationContract]
    string ReverseString(string value);
}

public interface ICallbacks
{
    [OperationContract( IsOneWay = true )]
    void MyCallbackFunction(string callbackValue);
}

public class StringReverser : IStringReverser
{
    public string ReverseString(string value)
    {
        char[] retVal = value.ToCharArray();
        int idx = 0;
        for (int i = value.Length - 1;i >= 0;i--)
            retVal[idx++] = value[i];

        ICallbacks callbacks =
     OperationContext.Current.GetCallbackChannel<ICallbacks>();

        callbacks.MyCallbackFunction( new string( retVal ) );

        return new string( retVal );
    }
}
  • 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-06-12T10:32:59+00:00Added an answer on June 12, 2026 at 10:32 am

    The Problem Solved So Easy,

    All The Problem was that i mistakenly close connection after click on button in server!

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

Sidebar

Related Questions

i used this code: List<string> lists=new List<string>(apple,orange,banana,apple,mang0,orange); string names; names=lists.Distinct() is that correct?
I used this link to get started with Sencha: http://www.sencha.com/learn/getting-started-with-sencha-touch-2/ My Main.js is as
i used this link How to find the primary key of select list that
I used this link to create a SHA1 hash for any data using C++.
I have used autocomplete in jQuery from this link . In the normal browser
i have a DTD file which i used to accessed through this link: http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd
i used this script to animate some divs with jquery and css. now i
I used this code to draw a line in a panel. private bool isMoving
I was reading this to learn how to zip/unzip files using Java. I used
I have used this link to crop image. It worked well for Android 2.3.3

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.