Setting web service timeout in vb.net

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?Qm9iIENvbm5vbGx5?=

    Setting web service timeout in vb.net

    How do I set the web service timeout in vb.net?
  • Steve Gerrard

    #2
    Re: Setting web service timeout in vb.net

    Bob Connolly wrote:
    How do I set the web service timeout in vb.net?
    The web.config file for the service can have a <httpRuntime/element, which
    includes an executionTimeou t attribute. The httpRuntime element goes in the
    <system.webelem ent. See this link:




    Comment

    • =?Utf-8?B?Qm9iIENvbm5vbGx5?=

      #3
      Re: Setting web service timeout in vb.net

      This link references asp.net. I am not using asp.net. I am accessing a web
      service in a windows console program and it keeps timing out. I have read
      that the default is 100 seconds. I want to increase this. What is the syntax
      that I should use in my program to do this?
      --
      Bob Connolly


      "Steve Gerrard" wrote:
      Bob Connolly wrote:
      How do I set the web service timeout in vb.net?
      >
      The web.config file for the service can have a <httpRuntime/element, which
      includes an executionTimeou t attribute. The httpRuntime element goes in the
      <system.webelem ent. See this link:
      >

      >
      >
      >

      Comment

      • Cor Ligthert[MVP]

        #4
        Re: Setting web service timeout in vb.net

        Bob,'

        A webservice = aspnet.

        If you want to do this in a windows form, than don't talk about a webservice
        timeout.
        Steve gave you a very nice answer, on something that you were not asking.

        Your question is to unclear to give a full answer, however probably you can
        let your thread sleep a while.

        Cor

        "Bob Connolly" <BobConnolly@di scussions.micro soft.comschreef in bericht
        news:ADCAAEF0-5B01-4ADD-A285-A22647373B6D@mi crosoft.com...
        This link references asp.net. I am not using asp.net. I am accessing a web
        service in a windows console program and it keeps timing out. I have read
        that the default is 100 seconds. I want to increase this. What is the
        syntax
        that I should use in my program to do this?
        --
        Bob Connolly
        >
        >
        "Steve Gerrard" wrote:
        >
        >Bob Connolly wrote:
        How do I set the web service timeout in vb.net?
        >>
        >The web.config file for the service can have a <httpRuntime/element,
        >which
        >includes an executionTimeou t attribute. The httpRuntime element goes in
        >the
        ><system.webele ment. See this link:
        >>
        >http://msdn2.microsoft.com/en-us/lib...41(VS.80).aspx
        >>
        >>
        >>

        Comment

        • Steve Gerrard

          #5
          Re: Setting web service timeout in vb.net

          Bob Connolly wrote:
          >>To do this I first added a Web reference (in Solution
          >>Explorer) which I called AmiClmSvc_WebSe rvice (setting the Web
          >>Reference URL property to point to the WSDL on my server with the
          >>web service). Then in my code I have:
          >>>
          >>Dim AmiClmSvc_Proxy As New AmiClmSvc_WebSe rvice.AmiClmSvc
          >>>
          Right, I have tried typing something like:
          >
          AmiClmSvc_Proxy .timeout = 5*60*1000
          >
          When I do this, there are no intellisense options and when I am done
          it gives me a syntax error: "Declaratio n expected"
          >
          I don't know what is up. I would not like to use a web service instance that had
          no properties.

          Maybe that should be
          Dim AmiClmSvc_Proxy As New AmiClmSvc_WebSe rvice

          If you don't have intellisense showing anything, how does it even make a call?


          Comment

          • =?Utf-8?B?Qm9iIENvbm5vbGx5?=

            #6
            Re: Setting web service timeout in vb.net

            In the previous post you say:

            Maybe that should be
            Dim AmiClmSvc_Proxy As New AmiClmSvc_WebSe rvice

            When I try this I get a syntax error on AmiClmSvc_WebSe rvice that tells me
            "Type Expected"

            What else do you suggest?
            --
            Bob Connolly


            "Steve Gerrard" wrote:
            Bob Connolly wrote:
            >To do this I first added a Web reference (in Solution
            >Explorer) which I called AmiClmSvc_WebSe rvice (setting the Web
            >Reference URL property to point to the WSDL on my server with the
            >web service). Then in my code I have:
            >>
            >Dim AmiClmSvc_Proxy As New AmiClmSvc_WebSe rvice.AmiClmSvc
            >>
            Right, I have tried typing something like:

            AmiClmSvc_Proxy .timeout = 5*60*1000

            When I do this, there are no intellisense options and when I am done
            it gives me a syntax error: "Declaratio n expected"
            >
            I don't know what is up. I would not like to use a web service instance that had
            no properties.
            >
            Maybe that should be
            Dim AmiClmSvc_Proxy As New AmiClmSvc_WebSe rvice
            >
            If you don't have intellisense showing anything, how does it even make a call?
            >
            >
            >

            Comment

            • Steve Gerrard

              #7
              Re: Setting web service timeout in vb.net

              Bob Connolly wrote:
              In the previous post you say:
              >
              Maybe that should be
              Dim AmiClmSvc_Proxy As New AmiClmSvc_WebSe rvice
              >
              When I try this I get a syntax error on AmiClmSvc_WebSe rvice that
              tells me "Type Expected"
              >
              What else do you suggest?
              >
              I don't really know. If you aren't getting intellisense on your proxy object, I
              don't see how you can do anything with it. Does it have any properties or
              methods, when you dim it the original way, As New AmiClmSvc_WebSe rvice.AmiClmSvc
              ?



              Comment

              • =?Utf-8?B?Qm9iIENvbm5vbGx5?=

                #8
                Re: Setting web service timeout in vb.net

                I was finally able to resolve this issue, though I do not fully understand
                why. When I originally coded as you suggested:

                AmiClmSvc_Proxy .Timeout = 60 * 60 * 1000 '60 minutes

                I got the errors that I described where I was not getting intellisense and
                syntax error: "Declaratio n expected". I was coding this statement at the
                Module level directly under the dim statement where I defined the
                AmiClmSvc_Proxy in the first place. I was finally able to resolve the issue
                when I coded the above statement within a SUB within the module. Suddenly the
                intellisense started working and the timeout was changed. I don't understand
                why the statement would work in one place and not the other, but it does.
                Perhaps you can explain why? In any event, it is working and I thank you for
                your help.

                --
                Bob Connolly


                "Steve Gerrard" wrote:
                Bob Connolly wrote:
                In the previous post you say:

                Maybe that should be
                Dim AmiClmSvc_Proxy As New AmiClmSvc_WebSe rvice

                When I try this I get a syntax error on AmiClmSvc_WebSe rvice that
                tells me "Type Expected"

                What else do you suggest?
                >
                I don't really know. If you aren't getting intellisense on your proxy object, I
                don't see how you can do anything with it. Does it have any properties or
                methods, when you dim it the original way, As New AmiClmSvc_WebSe rvice.AmiClmSvc
                ?
                >
                >
                >
                >

                Comment

                • Alex Novosad

                  #9
                  Re: Setting web service timeout in vb.net - CorLigthert[MVP]

                  Cor,

                  Please go back to school before you start offending other posters like Bob. I have no idea how you got your MVP or in what area your MVP is in, but I can tell it's not in .NET. "A webservice = aspnet" is an absurd statement. .NET Web services can be accessed from anywhere with anything and on any platform as long as that anything runs .NET. You can even call a web service from managed SQL since SQL 2005 came out, and you could call Web services from Windows Application since the beginning of .NET.

                  Bob, your question was 100% valid. To set timeout on a web service, first instantiate that web service. Let's say you called your web service MyFunkyService when you added Web Reference to it to your project. Then you'd instantiate it like this:

                  Dim myServiceInstan ce as New MyFunkyService. MyFunkyService

                  "MyFunkyService " repeats twice because by default when you add a web service, a proxy class is created and placed in the same namespace as class itself, so the first "MyFunkyService " refers to the namespace while the second one - to class name.

                  To set timeout to, say, 360 seconds, write:

                  myServiceInstan ce.Timeout = 360000 'in milliseconds

                  I think you're right that default is at 100 seconds or 100000 milliseconds.

                  Comment

                  Working...