Salve
sono nuovo del WCF
stavo testando alcune caratteristiche avendo incorporato su due applicazioni console, un server che espone un metodo di somma e un client che invoca tale funzione
Il problema è che ad ogni ripetizione del ciclo interno il tempo aumenta lento ma inesorabile.
O meglio questo succede SOLO avviando l'applicazione in debug.
Qualcuno sa dirmi cosa succede di preciso?
Grazie
Qui di seguito il codice.
class Program
{
static void Main(string[] args)
{
BasicHttpBinding httpBinding = new BasicHttpBinding();
//httpBinding.MaxReceivedMessageSize = 100000000;
//httpBinding.ReaderQuotas.MaxArrayLength = 100000000;
//httpBinding.Security.Mode = BasicHttpSecurityMode.None;
NetNamedPipeBinding pipeBinding = new NetNamedPipeBinding();
//pipeBinding.ReaderQuotas.MaxArrayLength = 100000000;
//pipeBinding.MaxReceivedMessageSize = 15000000;
//pipeBinding.Security.Mode = NetNamedPipeSecurityMode.None;
ChannelFactory<ISommatore> httpFactory =
new ChannelFactory<ISommatore>(
httpBinding,
new EndpointAddress(
"http://ceo01:8000/Reverse"));
ChannelFactory<ISommatore> pipeFactory =
new ChannelFactory<ISommatore>(
pipeBinding,
new EndpointAddress(
"net.pipe://ceo01/PipeReverse"));
ISommatore httpProxy =
httpFactory.CreateChannel();
ISommatore pipeProxy =
pipeFactory.CreateChannel();
DateTime tStartTime;
double dSecs = 0;
byte[] abImgData = null;
for (int j=0; j <100; j++)
{
try
{
tStartTime = DateTime.Now;
for (int i = 0; i < 1000; i++)
{
httpProxy.SommaNumeri(1, 1);
//pipeProxy.SommaNumeri(1,1);
}
dSecs = (DateTime.Now - tStartTime).TotalSeconds;
Console.WriteLine("http: Done in " + dSecs + " s");
//VsImg.GrayBMP(abImgData, 2048, 800).Save("./httpImgTransfer.bmp");
//tStartTime = DateTime.Now;
//abImgData = pipeProxy.GetImage();
//dSecs = (DateTime.Now - tStartTime).TotalSeconds;
//Console.WriteLine("pipe: Done in " + dSecs + " s");
//VsImg.GrayBMP(abImgData, 2048, 800).Save("./pipeImgTransfer.bmp");
}
catch (Exception ex)
{
Console.WriteLine("Errore: " + ex.Message.ToString());
}
}
}
}
}