/
aprogrammer
/
dotnet-docs
Обзор
Документация
Войти
/
aprogrammer
/
dotnet-docs
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
samples/snippets/visualbasic/VS_Snippets_CFX/faultcontractattribute/vb/client.vb
42 строки
2 KB
Next Turn
Format codes based on .editorconfig, Part 4 (#18853)
08 июн 2020, 22:49
Не верифицирован
08 июн 2020, 22:49
7e34efc
Код
Авторство
О чём код?
' <snippet3> Imports System.ServiceModel Imports System.ServiceModel.Channels Imports Microsoft.WCF.Documentation Public Class Client Public Shared Sub Main() ' Picks up configuration from the config file. Dim wcfClient As New SampleServiceClient() Try ' Making calls. Console.WriteLine("Enter the greeting to send: ") Dim greeting As String = Console.ReadLine() Console.WriteLine("The service responded: " & wcfClient.SampleMethod(greeting)) Console.WriteLine("Press ENTER to exit:") Console.ReadLine() ' Done with service. wcfClient.Close() Console.WriteLine("Done!") Catch timeProblem As TimeoutException Console.WriteLine("The service operation timed out. " & timeProblem.Message) Console.ReadLine() wcfClient.Abort() Catch greetingFault As FaultException(Of GreetingFault) Console.WriteLine(greetingFault.Detail.Message) Console.ReadLine() wcfClient.Abort() Catch unknownFault As FaultException Console.WriteLine("An unknown exception was received. " & unknownFault.Message) Console.ReadLine() wcfClient.Abort() Catch commProblem As CommunicationException Console.WriteLine("There was a communication problem. " & commProblem.Message + commProblem.StackTrace) Console.ReadLine() wcfClient.Abort() End Try End Sub End Class ' </snippet3>