hello
i have EndPointNotFoundException in wcf c#.net
where the proxy is generated dynamically. and all clients are preconnected to the server. but the problem arise when server call the client fuctions.
namespace QuBIC.VirtualCyberneticEnviornment
{
public partial class CyberneticEnviornmentWnd: QuBIC.Core.QuBICServiceBaseForm
{
private ServiceHost _CyberneticEnviornmentServiceHost;
private bool IamconnectedtoTaskManager = false;
public ServiceAgent MyAgent
{
get {
return (ServiceAgent)_MyAgent;
}
}
public CyberneticEnviornmentWnd()
{
InitializeComponent();
//_ServiceAgent.Signin += new SigninDelegate(_ServiceAgent_Signin);
}
public CyberneticEnviornmentWnd(ServiceAgentBase argMyAgent): base(argMyAgent)
{
InitializeComponent();
//_ServiceAgent.Signin += new SigninDelegate(_ServiceAgent_Signin);
grdConnections.DataSource = MyAgent.ConnectionPool.Connections;
Title = "CyberneticEnvironment [" + argMyAgent.MyProfile.ToString() + "]";
txtTaskMonitoringConsoleHostMachine.Text = Environment.MachineName;
MyAgent.OnSignin += new OnSigninDelegate(MyAgent_OnSignin);
MyAgent.UpdatedExternalMessage += new EventHandler<MessageEventArgs>(MyAgent_UpdatedExternalMessage);
StartHosting();
}
void MyAgent_UpdatedExternalMessage(object sender, MessageEventArgs e)
{
SetExternalMessage(e.Message);
}
void MyAgent_OnSignin(ServiceProfile rmtargServiceProfile)
{
lblConnectionCount.Text = MyAgent.ConnectionPool.Count.ToString();
}
private void StartHosting()
{
_CyberneticEnviornmentServiceHost = new ServiceHost(typeof(Service));
_CyberneticEnviornmentServiceHost.AddServiceEndpoint(typeof(IService), new NetTcpBinding(SecurityMode.None), "net.tcp://" + MyAgent.MyProfile.MyMachineProfile.ToString() + "/" + MyAgent.MyProfile.ServiceType.ToString() + "Service");
_CyberneticEnviornmentServiceHost.Open();
}
private void btnConnectToTaskMonitoringConsole_Click(object sender, EventArgs e)
{
lblConnectionStatus.Text = "Please Wait...";
ConnectToTaskMonitoringConsole();
IamconnectedtoTaskManager = true;
lblConnectionStatus.Text = "Connected";
btnConnectToTaskMonitoringConsole.Enabled = false;
}
private void ConnectToTaskMonitoringConsole()
{
SetInternalMessage("Connecting to Task Monitoring Console");
IService _TaskMonitoringProxy;
_TaskMonitoringProxy = ConnectionManager.ConnectToTaskManagerConsole(txtTaskMonitoringConsoleHostMachine.Text, txtTaskMonitoringConsolePort.Text, MyAgent);
lblConnectionStatus.Text = "Connected";
btnConnectToTaskMonitoringConsole.Enabled = false;
}
internal void SetInternalActivity(string argActivity)
{
txtInternalActivity.AppendText(argActivity + Environment.NewLine);
}
private void btnPingQuBIC_Click(object sender, EventArgs e)
{
_MyAgent.ConnectionPool[EServiceType.QuBICAgent].Ping(EServiceType.CyberneticEnvironment);
}
private void btnStartNewGame_Click(object sender, EventArgs e)
{
NewGame();
}
public void NewGame()
{
if (IamconnectedtoTaskManager == true)
{
DialogResult res = MessageBox.Show("Do you want to start a new game?", "Query", MessageBoxButtons.YesNo);
switch (res)
{
case DialogResult.Yes:
MyAgent.ConnectionPool[EServiceType.QuBICAgent].RequestToPlayGame();
// MyAgent.ConnectionPool[EServiceType.Avatar].Ping(EServiceType.CyberneticEnvironment);
[COLOR="Red"] MyAgent.ConnectionPool[EServiceType.Avatar].RequestToPlayGame();[/COLOR] MyAgent.ConnectionPool[EServiceType.Referee].RequestToPlayGame();
MessageBox.Show("I have requested the game to all players and referee");
break;
case DialogResult.No:
MessageBox.Show("No new game can start");
break;
}
}
else
{
MessageBox.Show("Cybernetic Environment Firstly should be connect to the Task Manager");
}
}
private void CyberneticEnviornmentWnd_Load(object sender, EventArgs e)
{
}
private void groupBox1_Enter(object sender, EventArgs e)
{
}
}
}