Time Out Exception On WCF Callback
I do not know Why I am recieving a TimeOutException in my code:
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.ChannelFactor开发者_JAVA技巧y.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
Is it reaching your service? Have you used Fiddler to see what is going on with communication? Use visual studio to attach to your service (self hosted) or attach to IIS (hosting under IIS) and set a break point on a entrypoint and see what's going on there.
It's possible that
- It isn't getting to your service
- Your service is taking too long and is timing out
精彩评论