2012-02-22 14 views
1

Webサービスが稼動しているかどうかを確認する最良の方法は何ですか?vb.net Webサービスのアクティブな接続テスト

これにはさまざまな要因がありますが、サービスを接続できるかどうかを確認するためにプロキシが構築された瞬間など、データを送信する前に簡単なことをしたいと思います。私はvb.netでコーディングしています。

このタイプの通信でもベストプラクティスはありますか?

+0

が重複する可能性への現在のバージョンログインし、[Webサービスが作動しているかどうか、私は見つけることができますどのように?]( http://stackoverflow.com/questions/3170380/how-can-i-find-out-if-a-web-service-is-running-or-not) –

答えて

1

おそらく最も簡単な方法は、現在のバージョンのような簡単な方法を照会して、Webサービスに "ping"することです。

例(PowerShellは、()メソッドのバージョン())のアプリケーションイベントログ

$ApplicationEventLog = New-Object System.Diagnostics.EventLog('Application') 
$ApplicationEventLog.Source = "My Webservice Ping" 

try 
{ 
    $wsproxy = New-WebserviceProxy -uri "http://mywebservice:7777/MyService.svc?wsdl" 
    $message = "My Webservice Version is {0}" -f $wsproxy.Version() 
} 
catch [System.Exception] 
{ 
    $ApplicationEventLog.WriteEntry($_.Exception.ToString(), [System.Diagnostics.EventLogEntryType]::Error) 
} 

$ApplicationEventLog.WriteEntry($message,[System.Diagnostics.EventLogEntryType]::Information) 
関連する問題