Как сделать вывод на textBox кто подключился через WCF?

Имеется сервер, WCF
<?xml version="1.0" encoding="utf-8" ?>


сервер является приложением WinForm
на Форме имеется textBox1
как вывести в textBox1 кто подключился к серверу
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using System.ServiceModel;
using System.Security.Principal;
using WcfChat;

namespace Chatserver
{
    public partial class Form1 : Form
    {
        public Form1()
        {
                InitializeComponent();

                ServiceHost host = new ServiceHost(typeof(ChatService));
            
                host.Open();
                textBox1.AppendText("Запуск Сервера..... \t\n");
                textBox1.AppendText("Configuration Name:   "   + host.Description.ConfigurationName         + "\t\n");
                textBox1.AppendText("End point address:    "    + host.Description.Endpoints[0].Address      + "\t\n");
                textBox1.AppendText("End point binding:    "    + host.Description.Endpoints[0].Binding.Name + "\t\n");
                textBox1.AppendText("End point contract:   "   + host.Description.Endpoints[0].Contract.ConfigurationName + "\t\n");
                textBox1.AppendText("End point name:       "       + host.Description.Endpoints[0].Name      + "\t\n");
                textBox1.AppendText("End point lisent uri: " + host.Description.Endpoints[0].ListenUri + "\t\n");
                textBox1.AppendText("Name:         "                  + host.Description.Name                   + "\t\n");
                textBox1.AppendText("Namespace:    "            + host.Description.Namespace              + "\t\n");
                textBox1.AppendText("Service Type: "         + host.Description.ServiceType            + "\t\n");
 
        }
         

    }
}
  • Вопрос задан
  • 108 просмотров
Пригласить эксперта
Ответы на вопрос 1
@vova-kms Автор вопроса
учусь
App.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.serviceModel>
    <services>
      <service name="WcfChat.ChatService">
        <!-- You can use your own local ip address instead of localhost, by this way, 
                     the app is going to work in a Local Area Network-->
        <endpoint address="http://localhost:12345/chatServer"
                  binding="wsHttpBinding"
                  contract="WcfChat.IChatService"/>
      </service>
    </services>
  </system.serviceModel>
</configuration>
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы