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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T17:50:41+00:00 2026-06-16T17:50:41+00:00

This simple WCF discovery example works on a single machine but when the client

  • 0

This simple WCF discovery example works on a single machine but when the client and server are running on separate machines in the same subnet with no firewall, it doesn’t work. What am I missing?

using System;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.ServiceModel;
using System.ServiceModel.Discovery;

namespace WCFDiscovery
{
   class Program
   {
      static void Main(string[] args)
      {
         try { if (args.Length > 0) StartClient(); else StartServer(); }
         catch (Exception ex) { Console.WriteLine(ex); }
         finally { Console.WriteLine("press enter to quit..."); Console.ReadLine(); }
      }

      private static void StartServer()
      {
         var ipAddress = Dns.GetHostAddresses(Dns.GetHostName()).First(ip => ip.AddressFamily == AddressFamily.InterNetwork);
         var address = new Uri(string.Format("net.tcp://{0}:3702", ipAddress));
         var host = new ServiceHost(typeof(Service), address);
         host.AddServiceEndpoint(typeof(IService), new NetTcpBinding(), address);
         host.Description.Behaviors.Add(new ServiceDiscoveryBehavior());
         host.AddServiceEndpoint(new UdpDiscoveryEndpoint());
         host.Open();
         Console.WriteLine("Started on {0}", address);
      }

      private static void StartClient()
      {
         var dc = new DiscoveryClient(new UdpDiscoveryEndpoint());
         Console.WriteLine("Searching for service...");
         var findResponse = dc.Find(new FindCriteria(typeof(IService)));
         var response = ChannelFactory<IService>.CreateChannel(new NetTcpBinding(), findResponse.Endpoints[0].Address).Add(1, 2);
         Console.WriteLine("Service response: {0}", response);
      }
   }

   [ServiceContract] interface IService { [OperationContract] int Add(int x, int y); }

   class Service : IService { public int Add(int x, int y) { return x + y; } }
}
  • 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-16T17:50:42+00:00Added an answer on June 16, 2026 at 5:50 pm

    I’ve run your code on 2 different machines (notebook (Win7) and tower PC (Win8), .NET FW 4.5, same WiFi network) and received following exception:

    A remote side security requirement was not fulfilled during authentication. Try increasing the ProtectionLevel and/or ImpersonationLevel.
    

    This one is due to the service security being underspecified, the endpoint were found. So, the guys in other answers are right – this is a network problem which can’t be fixed by correcting code.
    I’d add that another possible source of the problem may be the network switch not permitting UDP broadcasts.

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

Sidebar

Related Questions

I have a simple WCF publish/subscribe up and running, based on this example .
I'm learning about WCF and found this article on a simple WCF example. In
I am trying to use this simple code in WCF: Client Side: ServiceContractClient proxy
I have a simple WCF Client -> Server structure, where the client references the
I have a very simple (new to this) RESTful WCF service that uses a
This simple example fails to compile in VS2K8: io_service io2; shared_ptr<asio::deadline_timer> dt(make_shared<asio::deadline_timer>(io2, posix_time::seconds(20))); As
In this simple example, i want to create a String array populated with each
I have simple WCF Service Application (based on this tutorial : Getting Started ).
I created a simple WCF application which expose one operation. This operation takes a
Suppose this simple scenario: My client has an already working .net application and he/she

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.