Click here to Skip to main content
15,896,606 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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)
{
}


}
}
Posted

1 solution

End Point not found exception means exactly what it says. The client cannot find the end point that is specified. Make sure -

1. The end point address is correct.
2. The server is up and running and your WCF service is available
3. The endpoint mcght have changed if your service was updated. Make sure you have the proxy pointing to the latest updated service. You can try and recreate a new proxy and try again.
4. You might also want to look into the privilege of your client. i.e. your client should have enough privilege to access your service.

Hope this helps.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900