我不知道为什么我在代码中收到TimeOutException:
Dim Uri2 As New Uri("http://localhost:8733/Design_Time_Addresses/ssWcfService/Service1/")
Dim binding2 As New WSDualHttpBinding()
Dim callback = New MyCallBackClient()
Dim Client = New MyContractClient(callback, binding2, New EndpointAddress(Uri2))
'Dim Proxy = Client.ChannelFactory.CreateChannel()
Dim ProxyNotFaulty = Client.ChannelFactory.CreateChannel()
Try
Dim dataList As New List(Of DataClass)
Dim datas As New DataClass
RichTextBox.Text = "Connecting to WCF Service..."
RichTextBox.Text += Environment.NewLine + "Please Wait..."
RichTextBox.Text += Environment.NewLine + "Please Wait..."
RichTextBox.Text += Environment.NewLine + "The Operation is now Invoking..."
ProxyNotFaulty.DoSomething()
For Each Clientdata As DataClass In dataList
RichTextBox.Text += "The CallBack Status" + Clientdata.callbackMessage
RichTextBox.Text += Environment.NewLine
RichTextBox.Text += "After CallBack Status" + Clientdata.OnCallBackMessage
Next Clientdata
Client.Close()
Catch ex As Exception
MessageBox.Show("An Exception Happened:" + Environment.NewLine + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
Client.Abort()
Finally
End Try
Sub DoSomething() Implements IService1.DoSomething
data.callbackMessage = "Call Back is Made SuccessFully From Client To Service"
data.OnCallBackMessage = "Null"
dataList.Add(data)
Dim callBack = OperationContext.Current.GetCallbackChannel(Of IIIService1)()
callBack.OnCallBack()
End Sub
Public Interface IService1
<OperationContract()>
Sub DoSomething()
<OperationContract()>
Sub DoSomethingTwo()
<OperationContract()>
Function GetStatus() As List(Of DataClass)
'<OperationContract()>
'Function GetData(ByVal value As Integer) As String
'<OperationContract()>
'Function GetDataUsingDataContract(ByVal composite As CompositeType) As CompositeType
' TODO: Add your service operations here
End Interface
Public Interface IIIService1
<OperationContract(IsOneWay:=True)>
Sub OnCallBack()
<OperationContract(IsOneWay:=True)>
Sub OnCallBackFromService()
End Interface
答案 0 :(得分:0)
它是否可以满足您的服务需求?您是否使用过Fiddler来了解通信情况?使用visual studio附加到您的服务(自托管)或附加到IIS(在IIS下托管)并在入口点设置断点并查看其中发生的情况。
有可能