简体   繁体   English

WCF回调超时异常

[英]Time Out Exception On WCF Callback

I do not know Why I am recieving a TimeOutException in my code: 我不知道为什么我的代码中收到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

Is it reaching your service? 它能为您服务吗? Have you used Fiddler to see what is going on with communication? 您是否曾使用Fiddler来查看通信的进展情况? 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. 使用Visual Studio附加到您的服务(自行托管)或附加到IIS(在IIS下托管)并在入口点上设置断点,然后查看那里发生了什么。

It's possible that 有可能

  1. It isn't getting to your service 它没有为您服务
  2. Your service is taking too long and is timing out 您的服务时间过长,正在超时

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM