Test connection to WCF Services

  • Thread starter Alhambra Eidos Desarrollo
  • Start date
A

Alhambra Eidos Desarrollo

Hi all,

how can I test connection to my WCF services ? Which is the best way to do
it and how Microsoft MVPs do that ?

net.tcp://server:8092/ServicioSeguridad/servicio
net.tcp://server:8091/ServicioLog/servicio

How can I know if 8092 port is open in server machine ??

Thanks in advanced.


<client>
<endpoint address="net.tcp://server:8092/ServicioSeguridad/servicio"
binding="netTcpBinding" bindingConfiguration="NewBindingSINSeguridad"
contract="GRUPOBACKUP.WCF.Seguridad.Contrato.ISeguridad"
name="AgenteSeguridad" />

<endpoint address="net.tcp://server:8091/ServicioLog/servicio"
binding="netTcpBinding" bindingConfiguration="NewBindingSINSeguridad"
contract="GRUPOBACKUP.WCF.Log.Contrato.ILog" name="AgenteLog" />
</client>
 
A

Arne Vajhøj

Alhambra said:
how can I test connection to my WCF services ? Which is the best way to do
it and how Microsoft MVPs do that ?

net.tcp://server:8092/ServicioSeguridad/servicio
net.tcp://server:8091/ServicioLog/servicio

How can I know if 8092 port is open in server machine ??

Add a test method to the service that does nothing and call
that method.

Arne
 
A

Arne Vajhøj

Arne said:
Add a test method to the service that does nothing and call
that method.

That is in my opinion the best way.

I don't know if that is how MVP's does it.

Arne
 
P

Peter Morris

Add a test method to the service that does nothing and call
that method.

In my opinion it's pointless. You could test the server is available, and
by the time you get a positive response it may well no longer be available.
The correct approach is to only talk to the server when you need to, and
handle errors appropriately.
 
B

Bjørn Brox

Peter Morris skrev:
In my opinion it's pointless. You could test the server is available,
and by the time you get a positive response it may well no longer be
available. The correct approach is to only talk to the server when you
need to, and handle errors appropriately.
Correct.

Personally I also implement a version check which ask the web service
with version it is and compare it with the version the application is
compiled for.

public String WebserviceVersion()
{
return
System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
}

public bool WebserviceVersionCompatible(String expected_version)
{
//TODO
return String.Compare(WebserviceVersion(),
expected_version) == 0;
}

It's very useful if you later on make changes to the web service and can
tell why not everything is working as expected.
 
V

vreflect

bool success = false;
TcpClient TcpScan = new TcpClient();
try
{
TcpScan.Connect(address, port);
success = true;
}
catch { }
TcpScan.Close();

Put this in a method and check the success flag before making a wcf call and registering your WCF service with your client.

This will remove the delay you get when trying to make a dummy WCF call.



AlhambraEidosDesarroll wrote:

Test connection to WCF Services
16-Jan-09

Hi all

how can I test connection to my WCF services ? Which is the best way to do
it and how Microsoft MVPs do that

net.tcp://server:8092/ServicioSeguridad/servici
net.tcp://server:8091/ServicioLog/servici

How can I know if 8092 port is open in server machine ?

Thanks in advanced

<client
<endpoint address="net.tcp://server:8092/ServicioSeguridad/servicio
binding="netTcpBinding" bindingConfiguration="NewBindingSINSeguridad
contract="GRUPOBACKUP.WCF.Seguridad.Contrato.ISeguridad"
name="AgenteSeguridad" /

<endpoint address="net.tcp://server:8091/ServicioLog/servicio
binding="netTcpBinding" bindingConfiguration="NewBindingSINSeguridad
contract="GRUPOBACKUP.WCF.Log.Contrato.ILog" name="AgenteLog" /
</client

--
http://www.alhambra-eidos.es/web2005/index.htm
www.kiquenet.com/churrosof
http://www.setbb.com/putainformatica/viewtopic.php?p=84
www.trabajobasura.com/solusoft

Previous Posts In This Thread:

Test connection to WCF Services
Hi all

how can I test connection to my WCF services ? Which is the best way to do
it and how Microsoft MVPs do that

net.tcp://server:8092/ServicioSeguridad/servici
net.tcp://server:8091/ServicioLog/servici

How can I know if 8092 port is open in server machine ?

Thanks in advanced

<client
<endpoint address="net.tcp://server:8092/ServicioSeguridad/servicio
binding="netTcpBinding" bindingConfiguration="NewBindingSINSeguridad
contract="GRUPOBACKUP.WCF.Seguridad.Contrato.ISeguridad"
name="AgenteSeguridad" /

<endpoint address="net.tcp://server:8091/ServicioLog/servicio
binding="netTcpBinding" bindingConfiguration="NewBindingSINSeguridad
contract="GRUPOBACKUP.WCF.Log.Contrato.ILog" name="AgenteLog" /
</client

--
http://www.alhambra-eidos.es/web2005/index.htm
www.kiquenet.com/churrosof
http://www.setbb.com/putainformatica/viewtopic.php?p=84
www.trabajobasura.com/solusoft

Re: Test connection to WCF Services
Connect to it, if it fails it is not available


-
Pet
===
http://mrpmorris.blogspot.co
http://www.capableobjects.com - Think domain, not database

Re: Test connection to WCF Services
Alhambra Eidos Desarrollo wrote

Add a test method to the service that does nothing and cal
that method

Arne

Re: Test connection to WCF Services
Arne Vajh??j wrote

That is in my opinion the best way

I do not know if that is how MVP's does it

Arne

In my opinion it's pointless.
In my opinion it's pointless. You could test the server is available, and
by the time you get a positive response it may well no longer be available.
The correct approach is to only talk to the server when you need to, and
handle errors appropriately


--
Pet
===
http://mrpmorris.blogspot.co
http://www.capableobjects.com - Think domain, not database

Re: Test connection to WCF Services
Peter Morris skrev
Correct

Personally I also implement a version check which ask the web service
with version it is and compare it with the version the application is
compiled for

public String WebserviceVersion(

return
System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString()


public bool WebserviceVersionCompatible(String expected_version
{
//TODO
return String.Compare(WebserviceVersion(),
expected_version) == 0;
}

It's very useful if you later on make changes to the web service and can
tell why not everything is working as expected.


--
Bj??rn Brox


Submitted via EggHeadCafe - Software Developer Portal of Choice
Build a Google Search VS.Net IDE Macro
http://www.eggheadcafe.com/tutorial...25-924302fe7151/build-a-google-search-vs.aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top