Link to home
Start Free TrialLog in
Avatar of Larry Brister
Larry BristerFlag for United States of America

asked on

Web Service EndPoint

In my VB code below...how do I determine if the Endpoind address is "down?"

In other words, at times the database transactionlog may be full, or the server itself is down.

Dim wcfService = New StagingService.Service1Client
wcfService.Endpoint.Address = New System.ServiceModel.EndpointAddress(AppConfig("WebServiceIP"))

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Larry Brister

ASKER

CodeCruiser
That did the trick.

Here's my final solution

    Public Function isWebServiceUp() As Boolean
        Dim mexClient As MetadataExchangeClient
        Dim isServiceUp As Boolean = True
        Try
            Dim address As String = New System.ServiceModel.EndpointAddress(AppConfig("WebServiceIP")).ToString()
            mexClient = New MetadataExchangeClient(New Uri(address), MetadataExchangeClientMode.HttpGet)
            ' if service down I get the exception
            Dim metadata As MetadataSet = mexClient.GetMetadata()
        Catch ex As Exception
            isServiceUp = False
        End Try
        Return isServiceUp
    End Function