Answer the question
In order to leave comments, you need to log in
How to output on textBox who is connected via WCF?
There is a server, WCF
<?xml version="1.0" encoding="utf-8" ?>
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");
}
}
}
Answer the question
In order to leave comments, you need to log in
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>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question