J
Jon Davis
The following code runs fine. I let it go several thousand times and then
killed it.
private void button1_Click(object sender, EventArgs e)
{
int i = 0;
string opOutput = "n/a";
while (true)
{
localpipe.AdminServiceClient client = new
localpipe.AdminServiceClient("pipe");
//opOutput = client.MyOperation1("Yo");
listBox1.Items.Add(DateTime.Now.ToString() + " - " + (i++) + " " +
opOutput);
listBox1.SelectedIndex = listBox1.Items.Count - 1;
listBox1.Invalidate();
Application.DoEvents();
}
}
If I uncomment "opOutput = client.MyOperation1("Yo");", the loop executes 11
times and then everything freezes on the 12th invocation. The method being
invoked is the auto-generated method from the Visual Studio 2005 November
CTP extensions for WCF:
[ServiceContract()]
public interface IAdminService
{
[OperationContract]
string MyOperation1(string myValue);
}
public class AdminService : IAdminService
{
public string MyOperation1(string myValue)
{
return "Hello: " + myValue;
}
}
I tried this over both HTTP and net.pipe. Here is what the listeners are
doing:
internal class AdminServiceHost
{
internal static ServiceHost serviceHost = null;
internal static void StartService()
{
serviceHost = new ServiceHost(typeof(AdminService)); //,
baseAddress);
serviceHost.Open();
}
internal static void StopService()
{
if (serviceHost.State != CommunicationState.Closed)
serviceHost.Close();
}
}
....
<service name="MyApp.AdminService" behaviorConfiguration="returnFaults">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8080/MyApp/"/>
<add baseAddress="net.tcp://localhost:2063/MyApp/"/>
<add baseAddress="net.pipe://localhost/MyApp/"/>
</baseAddresses>
</host>
<endpoint contract="MyApp.IAdminService"
binding="wsHttpBinding"
name="http"
address="Admin" />
<endpoint contract="IMetadataExchange" binding="mexHttpBinding"
address="mex" />
<endpoint contract="MyApp.IAdminService"
binding="netTcpBinding"
name="tcp"
address="net.tcp://localhost:2064/MyApp/Admin" />
<endpoint contract="IMetadataExchange" binding="mexTcpBinding"
address="net.tcp://localhost:2063/MyApp/tcpmex" />
<endpoint contract="MyApp.IAdminService"
binding="netNamedPipeBinding"
name="pipe"
address="net.pipe://localhost/MyApp/Admin" />
<endpoint contract="IMetadataExchange" binding="mexNamedPipeBinding"
address="net.pipe://localhost/MyApp/pipemex" />
</service>
The client side is just the auto-generated service reference. I won't bother
pasting that XML here.
Any ideas?
Jon
killed it.
private void button1_Click(object sender, EventArgs e)
{
int i = 0;
string opOutput = "n/a";
while (true)
{
localpipe.AdminServiceClient client = new
localpipe.AdminServiceClient("pipe");
//opOutput = client.MyOperation1("Yo");
listBox1.Items.Add(DateTime.Now.ToString() + " - " + (i++) + " " +
opOutput);
listBox1.SelectedIndex = listBox1.Items.Count - 1;
listBox1.Invalidate();
Application.DoEvents();
}
}
If I uncomment "opOutput = client.MyOperation1("Yo");", the loop executes 11
times and then everything freezes on the 12th invocation. The method being
invoked is the auto-generated method from the Visual Studio 2005 November
CTP extensions for WCF:
[ServiceContract()]
public interface IAdminService
{
[OperationContract]
string MyOperation1(string myValue);
}
public class AdminService : IAdminService
{
public string MyOperation1(string myValue)
{
return "Hello: " + myValue;
}
}
I tried this over both HTTP and net.pipe. Here is what the listeners are
doing:
internal class AdminServiceHost
{
internal static ServiceHost serviceHost = null;
internal static void StartService()
{
serviceHost = new ServiceHost(typeof(AdminService)); //,
baseAddress);
serviceHost.Open();
}
internal static void StopService()
{
if (serviceHost.State != CommunicationState.Closed)
serviceHost.Close();
}
}
....
<service name="MyApp.AdminService" behaviorConfiguration="returnFaults">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8080/MyApp/"/>
<add baseAddress="net.tcp://localhost:2063/MyApp/"/>
<add baseAddress="net.pipe://localhost/MyApp/"/>
</baseAddresses>
</host>
<endpoint contract="MyApp.IAdminService"
binding="wsHttpBinding"
name="http"
address="Admin" />
<endpoint contract="IMetadataExchange" binding="mexHttpBinding"
address="mex" />
<endpoint contract="MyApp.IAdminService"
binding="netTcpBinding"
name="tcp"
address="net.tcp://localhost:2064/MyApp/Admin" />
<endpoint contract="IMetadataExchange" binding="mexTcpBinding"
address="net.tcp://localhost:2063/MyApp/tcpmex" />
<endpoint contract="MyApp.IAdminService"
binding="netNamedPipeBinding"
name="pipe"
address="net.pipe://localhost/MyApp/Admin" />
<endpoint contract="IMetadataExchange" binding="mexNamedPipeBinding"
address="net.pipe://localhost/MyApp/pipemex" />
</service>
The client side is just the auto-generated service reference. I won't bother
pasting that XML here.
Any ideas?
Jon