Greetings
I´m working on an wcf service to be hosted in an IIS 8.0 the service look like:
Interface:
namespace MCDWebService
{
[ServiceContract]
public interface IMCDService
{
[OperationContract]
Respuesta CapturarHuellas(string serialDispositivo);
}
[DataContract]
public class Respuesta
{
[DataMember]
public string Codigo { get; set; }
[DataMember]
public Parametro Parametros { get; set; }
[DataMember]
public string Mensaje { get; set; }
public Respuesta(string codigo, Parametro datos)
{
Codigo = codigo;
Parametros = datos;
}
public Respuesta(string codigo, string mensaje)
{
Codigo = codigo;
Mensaje = mensaje;
}
}
}
the idea is that the method "CapturarHuellas" connect asyc to a socket server and wait for the response event, it look like this:
namespace MCDWebService
{
[ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple, InstanceContextMode = InstanceContextMode.PerCall ) ]
public class MCDService : IMCDService
{
private SolicitudMCD solicitudMCD;
private System.Threading.EventWaitHandle eventoSocket;
private Respuesta respuesta;
public Respuesta CapturarHuellas(string serialDispositivo)
{
try
{
eventoSocket = new System.Threading.EventWaitHandle(true, System.Threading.EventResetMode.AutoReset);
solicitudMCD = new SolicitudMCD(IPAddress.Parse(ConfigurationManager.AppSettings.Get("IP_MCD")),
int.Parse(ConfigurationManager.AppSettings.Get("Puerto_MCD")), serialDispositivo);
solicitudMCD.Mensaje += solicitudMCD_Mensaje;
eventoSocket.Reset();
solicitudMCD.Solicitar();
if (eventoSocket.WaitOne(50000))
{
return respuesta;
}
else
{
return new Respuesta("MCD_003_010", "Se alcanzó el tiempo máximo de respuesta del MCD.");
}
}
catch (Exception ex)
{
return new Respuesta("MCD_003_000", ex.Message);
}
finally
{
eventoSocket.Dispose();
solicitudMCD = null;
}
}
void solicitudMCD_Mensaje(object sender, MensajeEventArgs e)
{
respuesta = new Respuesta(e.Codigo, e.Template);
eventoSocket.Set();
}
}
}
when I use this service on localhost and the client is also in localhost it has a concurrency of 100% answered requests, but when I take the service to a new machine with the same hardware the concurrency effectiveness drops to 19% answered requests :'( .
I don´t know if its something of the service or a configuration in the IIS.
Thanks
Drugdu