在其中一个WCF教程中,我看到了以下示例代码:
Dim service as ...(a WCF service ) try .. service.close() catch ex as Exception() ... service.abort() end try
我对这个模型好运:
原文链接:https://www.f2er.com/vb/255877.htmlDim service As New MyService() Dim closed As Boolean = False Try service.Open() If Not service.State = ServiceModel.CommunicationState.Opened Then ''Handle a not-opened state here End If service.MyMethod() service.Close() closed = true Catch ex As Exception ''Handle errors here Finally If Not closed Then service.Abort() End If End Try service = Nothing