hello
i have EndPointNotFoundException in WCF c#.net. exception occurs in the bold area of message. where the connection between the server and clients through dynamically generated proxies in pre define. but when the server call the client fucntion then this exception occurs.
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 UpdateConnectionRequest(MachineProfile argMachineProfile, EAgentType rmtargAgent)
{
if (rmtargAgent == EAgentType.Avatar)
{
Program._CybernticEnvironment.IsAvatarLoggedOn = true;
}
else if (rmtargAgent == EAgentType.QuBICAgent)
{
_QuBICAgentProxy = ChannelFactory<IPlayer>.CreateChannel(new NetTcpBinding(SecurityMode.None), new EndpointAddress("net.tcp://" + argMachineProfile.MachineName + ":" + argMachineProfile.Port + "/QuBICAgentService"));
Program._CybernticEnvironment.IsQuBICAgentLoggedOn = true;
}
_ConnectionPool.InsertConnection(argMachineProfile, rmtargAgent);
lblConnectionCount.Text = _ConnectionPool.Count.ToString();
}*/
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);
MyAgent.ConnectionPool[EServiceType.Avatar].RequestToPlayGame();
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)
{
}
}
}