Multithreaded consumer
- From: AC <andy.collyer@xxxxxxxxx>
- Date: Thu, 19 Jul 2007 11:20:43 -0000
Hi. I have a C# WebService with a WebMethod that returns an array of
(WebService-defined) objects. If I create a consumer exe and call the
method, everything is as expected.
If I then create a thread within my exe and call the WebMethod from
there, my thread dies. No exception, it just dies. At one point I
had a few unhandled socket exceptions mentioned in the Debug window,
but something's changed and they're not appearing now.
Here's the consumer code:
private void GetInfoButton_Click(object sender, EventArgs e)
{
if (CreateReference())
{
NetQCws.DynamicHostInfo[] infos =
m_WS.GetDynamicHostInfo();
foreach (NetQCws.DynamicHostInfo inf in infos)
Debug.WriteLine(string.Format("ST: {0}@{1} last
seen {2}", inf.Hostname, inf.IP_Address, inf.LastSeen.ToString("T")));
}
// and now threaded
System.Threading.Thread thr = new
System.Threading.Thread(new System.Threading.ThreadStart(ThreadProc));
thr.Name = "info worker thread";
thr.Start();
}
private void ThreadProc()
{
NetQCws.Service svc = new NetQCClient.NetQCws.Service();
try
{
NetQCws.DynamicHostInfo[] infos =
svc.GetDynamicHostInfo();
foreach (NetQCws.DynamicHostInfo inf in infos)
{
Debug.WriteLine("blah");
}
}
catch (Exception ex)
{
Debug.WriteLine(string.Format("ERROR: {0}",
ex.Message));
}
}
Any clues?
Thanks for your time,
Andy C
.
- Follow-Ups:
- Re: Multithreaded consumer
- From: John Saunders [MVP]
- Re: Multithreaded consumer
- From: John Saunders [MVP]
- Re: Multithreaded consumer
- Prev by Date: Consume the Web Service Source file in VB.NET
- Next by Date: Re: Internal Web Service
- Previous by thread: Consume the Web Service Source file in VB.NET
- Next by thread: Re: Multithreaded consumer
- Index(es):