Results 1 to 1 of 1

Thread: HttpChannel & TimeOut

  1. #1

    Thread Starter
    Hyperactive Member The_Duck's Avatar
    Join Date
    May 2005
    Location
    Leamington, UK
    Posts
    351

    Resolved HttpChannel & TimeOut

    http://msdn.microsoft.com/library/de...classtopic.asp

    Quite simply I want to specify a timeout property on a HTTP Channel I create.

    VB Code:
    1. Dim properties As New Hashtable()
    2.         properties("timeout") = 10000 '
    3.         properties("name") = "HttpBinary"
    4.         properties("port") = Convert.ToString(clientPort)
    5.         properties("useDefaultCredentials") = True
    6.  
    7.         Dim svFormatter As New BinaryServerFormatterSinkProvider()
    8.         Dim clFormatter As New BinaryClientFormatterSinkProvider()
    9.         svFormatter.TypeFilterLevel = TypeFilterLevel.Full
    10.  
    11.         mRemotingChannel = New HttpChannel(properties, clFormatter, svFormatter)

    However
    I get

    System.ArgumentException: Bad or unexpected argument passed to channel constructor: timeout
    at System.Runtime.Remoting.Channels.Http.HttpChannel..ctor(IDictionary properties, IClientChannelSinkProvider clientSinkProvider, IServerChannelSinkProvider serverSinkProvider)
    at vbBroadcast.Notification.InitRemoting(Int32 clientPort)

    Any and all comments would be appreciated !

    Ideally I would like to specify a time out period as our client applications hang and I am struggling to see why!

    Thanks in advance!

    ---

    I have managed to resolve this problem.

    Firstly I was trying to specify the timeout in the wrong place. I was attempting to specify the timeout on the initialisation of the server ! However THIS IS NOT correct. It is when you create your sever connction that you need to specify the timeout period! Thus

    VB Code:
    1. If mServer Is Nothing Then
    2.         mServer = DirectCast(Activator.GetObject( _
    3.             GetType(Switchboard), notificationServerUrl), Switchboard)
    4.  
    5.         ChannelServices.GetChannelSinkProperties(mServer)("timeout") = TimeSpan.FromSeconds(10).TotalMilliseconds 'units appear to be miliseconds

    Note that I also use GetChannelSinkProperties in order to specify the timeout period.

    Thanks all,
    Last edited by The_Duck; Jun 15th, 2005 at 05:01 AM. Reason: Resolved

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width