Gzip compression and SendTimeout

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Giorgio Parmeggiani

    Gzip compression and SendTimeout

    Hi

    I'm using the gzip compression found in WCG samples kit.
    It works well, but how can I set the SendTimeout and ReceiveTimeout
    parameters?

    Thank in advance

    Giorgio

  • Steven Cheng [MSFT]

    #2
    RE: Gzip compression and SendTimeout

    Hi Giorgio,

    From your description, you're using the sample gzip compression binding
    element and is wondering how to set send/receive timeout value like those
    built-in bindings(such as basicHttpbindin g) ,correct?

    Based on my research, the GZip compression classes the sample provided is a
    BindingElement which is used as one of the binding elements of a certain
    binding's Binding Element collection. And the BindingElement itself
    doesn't provide "SendTimeou t" , "Receivetimeout " setting, these two
    properties are provdied at Binding Level. Actually the built-in base class
    "Binding" has provided these two properties and other bindings like
    basicHttpBindin g or netTcpbinding just inhertited these two properties from
    the base class. I think you can define a custom Binding class to help set
    these values:


    #Creating User-Defined Bindings


    #How to: Create a Custom Binding Using the SecurityBinding Element


    Here is the test code I used which create a custom binding class
    programmaticall y and set the send/receive timeout properties:
    >>>>>>>>>>>>>>> >>>>>>>
    static void Run()
    {
    string EndPointAddress = "http://localhost:8000/mathservice";
    Uri[] baseAddresses = new Uri[1] { new Uri(EndPointAdd ress) };
    using (ServiceHost host = new ServiceHost(typ eof(MathService ),
    baseAddresses))
    {
    host.AddService Endpoint(typeof (IMathService),
    CreateCustomBin ding(), "");


    ServiceMetadata Behavior smb = new ServiceMetadata Behavior();
    smb.HttpGetEnab led = true;
    smb.HttpGetUrl = new Uri(EndPointAdd ress);
    host.Descriptio n.Behaviors.Add (smb);


    host.Open();
    Console.WriteLi ne("start...... ....");
    Console.ReadLin e();


    }



    }

    public static Binding CreateCustomBin ding()
    {
    // Create an empty BindingElementC ollection to populate,
    // then create a custom binding from it.
    BindingElementC ollection outputBec = new
    BindingElementC ollection();

    // Create a SymmetricSecuri tyBindingElemen t.
    SymmetricSecuri tyBindingElemen t ssbe =
    new SymmetricSecuri tyBindingElemen t();

    // Set the algorithm suite to one that uses 128-bit keys.
    ssbe.DefaultAlg orithmSuite = SecurityAlgorit hmSuite.Basic12 8;

    // Set MessageProtecti onOrder to SignBeforeEncry pt.
    ssbe.MessagePro tectionOrder =
    MessageProtecti onOrder.SignBef oreEncrypt;

    // Use a Kerberos token as the protection token.
    ssbe.Protection TokenParameters = new
    KerberosSecurit yTokenParameter s();

    // Add the SymmetricSecuri tyBindingElemen t to the
    BindingElementC ollection.
    outputBec.Add(s sbe);
    outputBec.Add(n ew TextMessageEnco dingBindingElem ent());
    outputBec.Add(n ew HttpTransportBi ndingElement()) ;

    // Create a CustomBinding and return it; otherwise, return null.
    CustomBinding cb = new CustomBinding(o utputBec);

    cb.SendTimeout = TimeSpan.FromMi nutes(33);
    cb.ReceiveTimeo ut = TimeSpan.FromMi nutes(33);


    return cb;

    }
    <<<<<<<<<<<<<<< <<<<<<<

    Sincerely,

    Steven Cheng

    Microsoft MSDN Online Support Lead


    Delighting our customers is our #1 priority. We welcome your comments and
    suggestions about how we can improve the support we provide to you. Please
    feel free to let my manager know what you think of the level of service
    provided. You can send feedback directly to my manager at:
    msdnmg@microsof t.com.

    =============== =============== =============== =====
    Get notification to my posts through email? Please refer to
    Gain technical skills through documentation and training, earn certifications and connect with the community

    ications.

    Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
    where an initial response from the community or a Microsoft Support
    Engineer within 1 business day is acceptable. Please note that each follow
    up response may take approximately 2 business days as the support
    professional working with you may need further investigation to reach the
    most efficient resolution. The offering is not appropriate for situations
    that require urgent, real-time or phone-based interactions or complex
    project analysis and dump analysis issues. Issues of this nature are best
    handled working with a dedicated Microsoft Support Engineer by contacting
    Microsoft Customer Support Services (CSS) at
    http://msdn.microsoft.com/subscripti...t/default.aspx.
    =============== =============== =============== =====
    This posting is provided "AS IS" with no warranties, and confers no rights.


    --------------------
    Reply-To: "Giorgio Parmeggiani" <gipasoft@tisca li.it>
    From: "Giorgio Parmeggiani" <gparmeggiani@n ewsgroup.nospam >
    Subject: Gzip compression and SendTimeout
    Date: Thu, 22 May 2008 03:22:12 +0200


    Hi

    I'm using the gzip compression found in WCG samples kit.
    It works well, but how can I set the SendTimeout and ReceiveTimeout
    parameters?

    Thank in advance

    Giorgio


    Comment

    • Giorgio Parmeggiani

      #3
      Re: Gzip compression and SendTimeout

      Thank for your reply.

      If I create a CustomBinding can I use it in my configuration file or I can
      use it only in code?

      Thank
      Giorgio

      "Steven Cheng [MSFT]" <stcheng@online .microsoft.comh a scritto nel
      messaggio news:d$plzZ9uIH A.2240@TK2MSFTN GHUB02.phx.gbl. ..
      Hi Giorgio,
      >
      From your description, you're using the sample gzip compression binding
      element and is wondering how to set send/receive timeout value like those
      built-in bindings(such as basicHttpbindin g) ,correct?
      >
      Based on my research, the GZip compression classes the sample provided is
      a
      BindingElement which is used as one of the binding elements of a certain
      binding's Binding Element collection. And the BindingElement itself
      doesn't provide "SendTimeou t" , "Receivetimeout " setting, these two
      properties are provdied at Binding Level. Actually the built-in base
      class
      "Binding" has provided these two properties and other bindings like
      basicHttpBindin g or netTcpbinding just inhertited these two properties
      from
      the base class. I think you can define a custom Binding class to help set
      these values:
      >
      >
      #Creating User-Defined Bindings

      >
      #How to: Create a Custom Binding Using the SecurityBinding Element

      >
      Here is the test code I used which create a custom binding class
      programmaticall y and set the send/receive timeout properties:
      >
      >>>>>>>>>>>>>>> >>>>>>>>
      static void Run()
      {
      string EndPointAddress = "http://localhost:8000/mathservice";
      Uri[] baseAddresses = new Uri[1] { new Uri(EndPointAdd ress) };
      using (ServiceHost host = new ServiceHost(typ eof(MathService ),
      baseAddresses))
      {
      host.AddService Endpoint(typeof (IMathService),
      CreateCustomBin ding(), "");
      >
      >
      ServiceMetadata Behavior smb = new
      ServiceMetadata Behavior();
      smb.HttpGetEnab led = true;
      smb.HttpGetUrl = new Uri(EndPointAdd ress);
      host.Descriptio n.Behaviors.Add (smb);
      >
      >
      host.Open();
      Console.WriteLi ne("start...... ....");
      Console.ReadLin e();
      >
      >
      }
      >
      >
      >
      }
      >
      public static Binding CreateCustomBin ding()
      {
      // Create an empty BindingElementC ollection to populate,
      // then create a custom binding from it.
      BindingElementC ollection outputBec = new
      BindingElementC ollection();
      >
      // Create a SymmetricSecuri tyBindingElemen t.
      SymmetricSecuri tyBindingElemen t ssbe =
      new SymmetricSecuri tyBindingElemen t();
      >
      // Set the algorithm suite to one that uses 128-bit keys.
      ssbe.DefaultAlg orithmSuite = SecurityAlgorit hmSuite.Basic12 8;
      >
      // Set MessageProtecti onOrder to SignBeforeEncry pt.
      ssbe.MessagePro tectionOrder =
      MessageProtecti onOrder.SignBef oreEncrypt;
      >
      // Use a Kerberos token as the protection token.
      ssbe.Protection TokenParameters = new
      KerberosSecurit yTokenParameter s();
      >
      // Add the SymmetricSecuri tyBindingElemen t to the
      BindingElementC ollection.
      outputBec.Add(s sbe);
      outputBec.Add(n ew TextMessageEnco dingBindingElem ent());
      outputBec.Add(n ew HttpTransportBi ndingElement()) ;
      >
      // Create a CustomBinding and return it; otherwise, return
      null.
      CustomBinding cb = new CustomBinding(o utputBec);
      >
      cb.SendTimeout = TimeSpan.FromMi nutes(33);
      cb.ReceiveTimeo ut = TimeSpan.FromMi nutes(33);
      >
      >
      return cb;
      >
      }
      <<<<<<<<<<<<<<< <<<<<<<
      >
      Sincerely,
      >
      Steven Cheng
      >
      Microsoft MSDN Online Support Lead
      >
      >
      Delighting our customers is our #1 priority. We welcome your comments and
      suggestions about how we can improve the support we provide to you. Please
      feel free to let my manager know what you think of the level of service
      provided. You can send feedback directly to my manager at:
      msdnmg@microsof t.com.
      >
      =============== =============== =============== =====
      Get notification to my posts through email? Please refer to
      Gain technical skills through documentation and training, earn certifications and connect with the community

      ications.
      >
      Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
      where an initial response from the community or a Microsoft Support
      Engineer within 1 business day is acceptable. Please note that each follow
      up response may take approximately 2 business days as the support
      professional working with you may need further investigation to reach the
      most efficient resolution. The offering is not appropriate for situations
      that require urgent, real-time or phone-based interactions or complex
      project analysis and dump analysis issues. Issues of this nature are best
      handled working with a dedicated Microsoft Support Engineer by contacting
      Microsoft Customer Support Services (CSS) at
      http://msdn.microsoft.com/subscripti...t/default.aspx.
      =============== =============== =============== =====
      This posting is provided "AS IS" with no warranties, and confers no
      rights.
      >
      >
      --------------------
      Reply-To: "Giorgio Parmeggiani" <gipasoft@tisca li.it>
      From: "Giorgio Parmeggiani" <gparmeggiani@n ewsgroup.nospam >
      Subject: Gzip compression and SendTimeout
      Date: Thu, 22 May 2008 03:22:12 +0200
      >
      >
      Hi
      >
      I'm using the gzip compression found in WCG samples kit.
      It works well, but how can I set the SendTimeout and ReceiveTimeout
      parameters?
      >
      Thank in advance
      >
      Giorgio
      >
      >

      Comment

      • Steven Cheng [MSFT]

        #4
        Re: Gzip compression and SendTimeout

        Hi Giorgio,

        For declarative configuration, I think it should be the following syntax:
        >>>>>>>>>>>>>
        <customBindin g>

        <binding name="BufferedH ttpSampleServer " SendTimeout="00 :33:00">

        <gzipMessageEnc oding innerMessageEnc oding="textMess ageEncoding" />
        ............... ..

        <<<<<<<<<<<<<<< <<<<<<<<<<<

        So far I have only tried the programmtic approach and will also perform
        research to confirm for the declarative behavior. I'll inform you on this
        later.

        Sincerely,

        Steven Cheng

        Microsoft MSDN Online Support Lead


        Delighting our customers is our #1 priority. We welcome your comments and
        suggestions about how we can improve the support we provide to you. Please
        feel free to let my manager know what you think of the level of service
        provided. You can send feedback directly to my manager at:
        msdnmg@microsof t.com.

        =============== =============== =============== =====
        Get notification to my posts through email? Please refer to
        Gain technical skills through documentation and training, earn certifications and connect with the community

        ications.
        =============== =============== =============== =====
        This posting is provided "AS IS" with no warranties, and confers no rights.



        --------------------
        Reply-To: "Giorgio Parmeggiani" <gipasoft@tisca li.it>
        From: "Giorgio Parmeggiani" <gparmeggiani@n ewsgroup.nospam >
        References: <B791758E-1F71-4EDF-BDE0-429143298715@mi crosoft.com>
        <d$plzZ9uIHA.22 40@TK2MSFTNGHUB 02.phx.gbl>
        Subject: Re: Gzip compression and SendTimeout
        Date: Thu, 22 May 2008 10:31:15 +0200


        Thank for your reply.

        If I create a CustomBinding can I use it in my configuration file or I can
        use it only in code?

        Thank
        Giorgio

        "Steven Cheng [MSFT]" <stcheng@online .microsoft.comh a scritto nel
        messaggio news:d$plzZ9uIH A.2240@TK2MSFTN GHUB02.phx.gbl. ..
        Hi Giorgio,
        >
        From your description, you're using the sample gzip compression binding
        element and is wondering how to set send/receive timeout value like those
        built-in bindings(such as basicHttpbindin g) ,correct?
        >
        Based on my research, the GZip compression classes the sample provided is
        a
        BindingElement which is used as one of the binding elements of a certain
        binding's Binding Element collection. And the BindingElement itself
        doesn't provide "SendTimeou t" , "Receivetimeout " setting, these two
        properties are provdied at Binding Level. Actually the built-in base
        class
        "Binding" has provided these two properties and other bindings like
        basicHttpBindin g or netTcpbinding just inhertited these two properties
        from
        the base class. I think you can define a custom Binding class to help set
        these values:
        >
        >
        #Creating User-Defined Bindings

        >
        #How to: Create a Custom Binding Using the SecurityBinding Element

        >
        Here is the test code I used which create a custom binding class
        programmaticall y and set the send/receive timeout properties:
        >
        >>>>>>>>>>>>>>> >>>>>>>>
        static void Run()
        {
        string EndPointAddress = "http://localhost:8000/mathservice";
        Uri[] baseAddresses = new Uri[1] { new Uri(EndPointAdd ress) };
        using (ServiceHost host = new ServiceHost(typ eof(MathService ),
        baseAddresses))
        {
        host.AddService Endpoint(typeof (IMathService),
        CreateCustomBin ding(), "");
        >
        >
        ServiceMetadata Behavior smb = new
        ServiceMetadata Behavior();
        smb.HttpGetEnab led = true;
        smb.HttpGetUrl = new Uri(EndPointAdd ress);
        host.Descriptio n.Behaviors.Add (smb);
        >
        >
        host.Open();
        Console.WriteLi ne("start...... ....");
        Console.ReadLin e();
        >
        >
        }
        >
        >
        >
        }
        >
        public static Binding CreateCustomBin ding()
        {
        // Create an empty BindingElementC ollection to populate,
        // then create a custom binding from it.
        BindingElementC ollection outputBec = new
        BindingElementC ollection();
        >
        // Create a SymmetricSecuri tyBindingElemen t.
        SymmetricSecuri tyBindingElemen t ssbe =
        new SymmetricSecuri tyBindingElemen t();
        >
        // Set the algorithm suite to one that uses 128-bit keys.
        ssbe.DefaultAlg orithmSuite = SecurityAlgorit hmSuite.Basic12 8;
        >
        // Set MessageProtecti onOrder to SignBeforeEncry pt.
        ssbe.MessagePro tectionOrder =
        MessageProtecti onOrder.SignBef oreEncrypt;
        >
        // Use a Kerberos token as the protection token.
        ssbe.Protection TokenParameters = new
        KerberosSecurit yTokenParameter s();
        >
        // Add the SymmetricSecuri tyBindingElemen t to the
        BindingElementC ollection.
        outputBec.Add(s sbe);
        outputBec.Add(n ew TextMessageEnco dingBindingElem ent());
        outputBec.Add(n ew HttpTransportBi ndingElement()) ;
        >
        // Create a CustomBinding and return it; otherwise, return
        null.
        CustomBinding cb = new CustomBinding(o utputBec);
        >
        cb.SendTimeout = TimeSpan.FromMi nutes(33);
        cb.ReceiveTimeo ut = TimeSpan.FromMi nutes(33);
        >
        >
        return cb;
        >
        }
        <<<<<<<<<<<<<<< <<<<<<<
        >
        Sincerely,

        Comment

        • Steven Cheng [MSFT]

          #5
          Re: Gzip compression and SendTimeout

          Hi Giorgio,

          Have you got progress on this? As for declarative configuration, you can
          directly set the attribute in customBinding element. If you have any other
          questions, welcome to post here also.

          Sincerely,

          Steven Cheng

          Microsoft MSDN Online Support Lead


          Delighting our customers is our #1 priority. We welcome your comments and
          suggestions about how we can improve the support we provide to you. Please
          feel free to let my manager know what you think of the level of service
          provided. You can send feedback directly to my manager at:
          msdnmg@microsof t.com.

          =============== =============== =============== =====
          Get notification to my posts through email? Please refer to
          Gain technical skills through documentation and training, earn certifications and connect with the community

          ications.

          =============== =============== =============== =====
          This posting is provided "AS IS" with no warranties, and confers no rights.
          --------------------
          Content-Type: multipart/alternative; boundary="----=_NextPart_0001 _0CCBBF9E"
          Content-Transfer-Encoding: 7bit
          From: stcheng@online. microsoft.com (Steven Cheng [MSFT])
          Organization: Microsoft
          Date: Fri, 23 May 2008 03:07:21 GMT
          Subject: Re: Gzip compression and SendTimeout


          Hi Giorgio,

          For declarative configuration, I think it should be the following syntax:
          >>>>>>>>>>>>>
          <customBindin g>

          <binding name="BufferedH ttpSampleServer " SendTimeout="00 :33:00">

          <gzipMessageEnc oding innerMessageEnc oding="textMess ageEncoding" />
          ............... ..

          <<<<<<<<<<<<<<< <<<<<<<<<<<

          So far I have only tried the programmtic approach and will also perform
          research to confirm for the declarative behavior. I'll inform you on this
          later.

          Sincerely,

          Steven Cheng

          Microsoft MSDN Online Support Lead


          Delighting our customers is our #1 priority. We welcome your comments and
          suggestions about how we can improve the support we provide to you. Please
          feel free to let my manager know what you think of the level of service
          provided. You can send feedback directly to my manager at:
          msdnmg@microsof t.com.

          =============== =============== =============== =====
          Get notification to my posts through email? Please refer to
          Gain technical skills through documentation and training, earn certifications and connect with the community

          ications.
          =============== =============== =============== =====
          This posting is provided "AS IS" with no warranties, and confers no rights.



          --------------------
          Reply-To: "Giorgio Parmeggiani" <gipasoft@tisca li.it>
          From: "Giorgio Parmeggiani" <gparmeggiani@n ewsgroup.nospam >
          References: <B791758E-1F71-4EDF-BDE0-429143298715@mi crosoft.com>
          <d$plzZ9uIHA.22 40@TK2MSFTNGHUB 02.phx.gbl>
          Subject: Re: Gzip compression and SendTimeout
          Date: Thu, 22 May 2008 10:31:15 +0200


          Thank for your reply.

          If I create a CustomBinding can I use it in my configuration file or I can
          use it only in code?

          Thank
          Giorgio

          "Steven Cheng [MSFT]" <stcheng@online .microsoft.comh a scritto nel
          messaggio news:d$plzZ9uIH A.2240@TK2MSFTN GHUB02.phx.gbl. ..
          Hi Giorgio,
          >
          From your description, you're using the sample gzip compression binding
          element and is wondering how to set send/receive timeout value like those
          built-in bindings(such as basicHttpbindin g) ,correct?
          >
          Based on my research, the GZip compression classes the sample provided is
          a
          BindingElement which is used as one of the binding elements of a certain
          binding's Binding Element collection. And the BindingElement itself
          doesn't provide "SendTimeou t" , "Receivetimeout " setting, these two
          properties are provdied at Binding Level. Actually the built-in base
          class
          "Binding" has provided these two properties and other bindings like
          basicHttpBindin g or netTcpbinding just inhertited these two properties
          from
          the base class. I think you can define a custom Binding class to help set
          these values:
          >
          >
          #Creating User-Defined Bindings

          >
          #How to: Create a Custom Binding Using the SecurityBinding Element

          >
          Here is the test code I used which create a custom binding class
          programmaticall y and set the send/receive timeout properties:
          >
          >>>>>>>>>>>>>>> >>>>>>>>
          static void Run()
          {
          string EndPointAddress = "http://localhost:8000/mathservice";
          Uri[] baseAddresses = new Uri[1] { new Uri(EndPointAdd ress) };
          using (ServiceHost host = new ServiceHost(typ eof(MathService ),
          baseAddresses))
          {
          host.AddService Endpoint(typeof (IMathService),
          CreateCustomBin ding(), "");
          >
          >
          ServiceMetadata Behavior smb = new
          ServiceMetadata Behavior();
          smb.HttpGetEnab led = true;
          smb.HttpGetUrl = new Uri(EndPointAdd ress);
          host.Descriptio n.Behaviors.Add (smb);
          >
          >
          host.Open();
          Console.WriteLi ne("start...... ....");
          Console.ReadLin e();
          >
          >
          }
          >
          >
          >
          }
          >
          public static Binding CreateCustomBin ding()
          {
          // Create an empty BindingElementC ollection to populate,
          // then create a custom binding from it.
          BindingElementC ollection outputBec = new
          BindingElementC ollection();
          >
          // Create a SymmetricSecuri tyBindingElemen t.
          SymmetricSecuri tyBindingElemen t ssbe =
          new SymmetricSecuri tyBindingElemen t();
          >
          // Set the algorithm suite to one that uses 128-bit keys.
          ssbe.DefaultAlg orithmSuite = SecurityAlgorit hmSuite.Basic12 8;
          >
          // Set MessageProtecti onOrder to SignBeforeEncry pt.
          ssbe.MessagePro tectionOrder =
          MessageProtecti onOrder.SignBef oreEncrypt;
          >
          // Use a Kerberos token as the protection token.
          ssbe.Protection TokenParameters = new
          KerberosSecurit yTokenParameter s();
          >
          // Add the SymmetricSecuri tyBindingElemen t to the
          BindingElementC ollection.
          outputBec.Add(s sbe);
          outputBec.Add(n ew TextMessageEnco dingBindingElem ent());
          outputBec.Add(n ew HttpTransportBi ndingElement()) ;
          >
          // Create a CustomBinding and return it; otherwise, return
          null.
          CustomBinding cb = new CustomBinding(o utputBec);
          >
          cb.SendTimeout = TimeSpan.FromMi nutes(33);
          cb.ReceiveTimeo ut = TimeSpan.FromMi nutes(33);
          >
          >
          return cb;
          >
          }
          <<<<<<<<<<<<<<< <<<<<<<
          >
          Sincerely,

          Comment

          • Giorgio Parmeggiani

            #6
            Re: Gzip compression and SendTimeout

            Yes

            I have tried the declarative approach and it works very well.

            Thank for your suggestions

            "Steven Cheng [MSFT]" <stcheng@online .microsoft.comh a scritto nel
            messaggio news:OOEYDh8vIH A.5796@TK2MSFTN GHUB02.phx.gbl. ..
            Hi Giorgio,
            >
            Have you got progress on this? As for declarative configuration, you can
            directly set the attribute in customBinding element. If you have any other
            questions, welcome to post here also.
            >
            Sincerely,
            >
            Steven Cheng
            >
            Microsoft MSDN Online Support Lead
            >
            >
            Delighting our customers is our #1 priority. We welcome your comments and
            suggestions about how we can improve the support we provide to you. Please
            feel free to let my manager know what you think of the level of service
            provided. You can send feedback directly to my manager at:
            msdnmg@microsof t.com.
            >
            =============== =============== =============== =====
            Get notification to my posts through email? Please refer to
            Gain technical skills through documentation and training, earn certifications and connect with the community

            ications.
            >
            =============== =============== =============== =====
            This posting is provided "AS IS" with no warranties, and confers no
            rights.
            --------------------
            Content-Type: multipart/alternative;
            boundary="----=_NextPart_0001 _0CCBBF9E"
            Content-Transfer-Encoding: 7bit
            From: stcheng@online. microsoft.com (Steven Cheng [MSFT])
            Organization: Microsoft
            Date: Fri, 23 May 2008 03:07:21 GMT
            Subject: Re: Gzip compression and SendTimeout
            >
            >
            Hi Giorgio,
            >
            For declarative configuration, I think it should be the following syntax:
            >
            >>>>>>>>>>>>> >
            <customBindin g>
            >
            <binding name="BufferedH ttpSampleServer " SendTimeout="00 :33:00">
            >
            <gzipMessageEnc oding innerMessageEnc oding="textMess ageEncoding"
            />
            ............... .
            >
            <<<<<<<<<<<<<<< <<<<<<<<<<<
            >
            So far I have only tried the programmtic approach and will also perform
            research to confirm for the declarative behavior. I'll inform you on this
            later.
            >
            Sincerely,
            >
            Steven Cheng
            >
            Microsoft MSDN Online Support Lead
            >
            >
            Delighting our customers is our #1 priority. We welcome your comments and
            suggestions about how we can improve the support we provide to you. Please
            feel free to let my manager know what you think of the level of service
            provided. You can send feedback directly to my manager at:
            msdnmg@microsof t.com.
            >
            =============== =============== =============== =====
            Get notification to my posts through email? Please refer to
            Gain technical skills through documentation and training, earn certifications and connect with the community

            ications.
            =============== =============== =============== =====
            This posting is provided "AS IS" with no warranties, and confers no
            rights.
            >
            >
            >
            --------------------
            Reply-To: "Giorgio Parmeggiani" <gipasoft@tisca li.it>
            From: "Giorgio Parmeggiani" <gparmeggiani@n ewsgroup.nospam >
            References: <B791758E-1F71-4EDF-BDE0-429143298715@mi crosoft.com>
            <d$plzZ9uIHA.22 40@TK2MSFTNGHUB 02.phx.gbl>
            Subject: Re: Gzip compression and SendTimeout
            Date: Thu, 22 May 2008 10:31:15 +0200
            >
            >
            Thank for your reply.
            >
            If I create a CustomBinding can I use it in my configuration file or I can
            use it only in code?
            >
            Thank
            Giorgio
            >
            "Steven Cheng [MSFT]" <stcheng@online .microsoft.comh a scritto nel
            messaggio news:d$plzZ9uIH A.2240@TK2MSFTN GHUB02.phx.gbl. ..
            >Hi Giorgio,
            >>
            >From your description, you're using the sample gzip compression binding
            >element and is wondering how to set send/receive timeout value like those
            >built-in bindings(such as basicHttpbindin g) ,correct?
            >>
            >Based on my research, the GZip compression classes the sample provided is
            >a
            >BindingEleme nt which is used as one of the binding elements of a certain
            >binding's Binding Element collection. And the BindingElement itself
            >doesn't provide "SendTimeou t" , "Receivetimeout " setting, these two
            >properties are provdied at Binding Level. Actually the built-in base
            >class
            >"Binding" has provided these two properties and other bindings like
            >basicHttpBindi ng or netTcpbinding just inhertited these two properties
            >from
            >the base class. I think you can define a custom Binding class to help
            >set
            >these values:
            >>
            >>
            >#Creating User-Defined Bindings
            >http://msdn.microsoft.com/en-us/library/ms733893.aspx
            >>
            >#How to: Create a Custom Binding Using the SecurityBinding Element
            >http://msdn.microsoft.com/en-us/library/ms730305.aspx
            >>
            >Here is the test code I used which create a custom binding class
            >programmatical ly and set the send/receive timeout properties:
            >>
            >>>>>>>>>>>>>>> >>>>>>>>>
            >static void Run()
            > {
            > string EndPointAddress = "http://localhost:8000/mathservice";
            > Uri[] baseAddresses = new Uri[1] { new Uri(EndPointAdd ress) };
            > using (ServiceHost host = new ServiceHost(typ eof(MathService ),
            >baseAddresses) )
            > {
            > host.AddService Endpoint(typeof (IMathService),
            >CreateCustomBi nding(), "");
            >>
            >>
            > ServiceMetadata Behavior smb = new
            >ServiceMetadat aBehavior();
            > smb.HttpGetEnab led = true;
            > smb.HttpGetUrl = new Uri(EndPointAdd ress);
            > host.Descriptio n.Behaviors.Add (smb);
            >>
            >>
            > host.Open();
            > Console.WriteLi ne("start...... ....");
            > Console.ReadLin e();
            >>
            >>
            > }
            >>
            >>
            >>
            > }
            >>
            > public static Binding CreateCustomBin ding()
            > {
            > // Create an empty BindingElementC ollection to populate,
            > // then create a custom binding from it.
            > BindingElementC ollection outputBec = new
            >BindingElement Collection();
            >>
            > // Create a SymmetricSecuri tyBindingElemen t.
            > SymmetricSecuri tyBindingElemen t ssbe =
            > new SymmetricSecuri tyBindingElemen t();
            >>
            > // Set the algorithm suite to one that uses 128-bit keys.
            > ssbe.DefaultAlg orithmSuite = SecurityAlgorit hmSuite.Basic12 8;
            >>
            > // Set MessageProtecti onOrder to SignBeforeEncry pt.
            > ssbe.MessagePro tectionOrder =
            >MessageProtect ionOrder.SignBe foreEncrypt;
            >>
            > // Use a Kerberos token as the protection token.
            > ssbe.Protection TokenParameters = new
            >KerberosSecuri tyTokenParamete rs();
            >>
            > // Add the SymmetricSecuri tyBindingElemen t to the
            >BindingElement Collection.
            > outputBec.Add(s sbe);
            > outputBec.Add(n ew TextMessageEnco dingBindingElem ent());
            > outputBec.Add(n ew HttpTransportBi ndingElement()) ;
            >>
            > // Create a CustomBinding and return it; otherwise, return
            >null.
            > CustomBinding cb = new CustomBinding(o utputBec);
            >>
            > cb.SendTimeout = TimeSpan.FromMi nutes(33);
            > cb.ReceiveTimeo ut = TimeSpan.FromMi nutes(33);
            >>
            >>
            > return cb;
            >>
            > }
            ><<<<<<<<<<<<<< <<<<<<<<
            >>
            >Sincerely,
            >
            >

            Comment

            • Steven Cheng [MSFT]

              #7
              Re: Gzip compression and SendTimeout

              Thanks for your reply Giorgio,

              I'm glad that you've also got it working.

              Have a nice day!

              Sincerely,

              Steven Cheng

              Microsoft MSDN Online Support Lead


              Delighting our customers is our #1 priority. We welcome your comments and
              suggestions about how we can improve the support we provide to you. Please
              feel free to let my manager know what you think of the level of service
              provided. You can send feedback directly to my manager at:
              msdnmg@microsof t.com.

              =============== =============== =============== =====
              Get notification to my posts through email? Please refer to
              Gain technical skills through documentation and training, earn certifications and connect with the community

              ications.

              =============== =============== =============== =====
              This posting is provided "AS IS" with no warranties, and confers no rights.
              --------------------
              Reply-To: "Giorgio Parmeggiani" <gipasoft@tisca li.it>
              From: "Giorgio Parmeggiani" <gparmeggiani@n ewsgroup.nospam >
              References: <B791758E-1F71-4EDF-BDE0-429143298715@mi crosoft.com>
              <d$plzZ9uIHA.22 40@TK2MSFTNGHUB 02.phx.gbl>
              <5CF6E584-AEB5-409C-B2D7-1428572022EB@mi crosoft.com>
              <TU0rkIIvIHA.40 88@TK2MSFTNGHUB 02.phx.gbl>
              <OOEYDh8vIHA.57 96@TK2MSFTNGHUB 02.phx.gbl>
              Subject: Re: Gzip compression and SendTimeout
              Date: Wed, 28 May 2008 10:06:01 +0200

              Yes

              I have tried the declarative approach and it works very well.

              Thank for your suggestions

              "Steven Cheng [MSFT]" <stcheng@online .microsoft.comh a scritto nel
              messaggio news:OOEYDh8vIH A.5796@TK2MSFTN GHUB02.phx.gbl. ..
              Hi Giorgio,
              >
              Have you got progress on this? As for declarative configuration, you can
              directly set the attribute in customBinding element. If you have any other
              questions, welcome to post here also.
              >
              Sincerely,
              >
              Steven Cheng
              >
              Microsoft MSDN Online Support Lead
              >
              >
              Delighting our customers is our #1 priority. We welcome your comments and
              suggestions about how we can improve the support we provide to you. Please
              feel free to let my manager know what you think of the level of service
              provided. You can send feedback directly to my manager at:
              msdnmg@microsof t.com.
              >
              =============== =============== =============== =====
              Get notification to my posts through email? Please refer to
              >
              http://msdn.microsoft.com/subscripti...ult.aspx#notif
              ications.
              >
              =============== =============== =============== =====
              This posting is provided "AS IS" with no warranties, and confers no
              rights.
              --------------------
              Content-Type: multipart/alternative;
              boundary="----=_NextPart_0001 _0CCBBF9E"
              Content-Transfer-Encoding: 7bit
              From: stcheng@online. microsoft.com (Steven Cheng [MSFT])
              Organization: Microsoft
              Date: Fri, 23 May 2008 03:07:21 GMT
              Subject: Re: Gzip compression and SendTimeout
              >
              >
              Hi Giorgio,
              >
              For declarative configuration, I think it should be the following syntax:
              >
              >>>>>>>>>>>>> >
              <customBindin g>
              >
              <binding name="BufferedH ttpSampleServer " SendTimeout="00 :33:00">
              >
              <gzipMessageEnc oding innerMessageEnc oding="textMess ageEncoding"
              />
              ............... .
              >
              <<<<<<<<<<<<<<< <<<<<<<<<<<
              >
              So far I have only tried the programmtic approach and will also perform
              research to confirm for the declarative behavior. I'll inform you on this
              later.
              >
              Sincerely,
              >
              Steven Cheng
              >
              Microsoft MSDN Online Support Lead
              >
              >
              Delighting our customers is our #1 priority. We welcome your comments and
              suggestions about how we can improve the support we provide to you. Please
              feel free to let my manager know what you think of the level of service
              provided. You can send feedback directly to my manager at:
              msdnmg@microsof t.com.
              >
              =============== =============== =============== =====
              Get notification to my posts through email? Please refer to
              >
              http://msdn.microsoft.com/subscripti...ult.aspx#notif
              ications.
              =============== =============== =============== =====
              This posting is provided "AS IS" with no warranties, and confers no
              rights.
              >
              >
              >
              --------------------
              Reply-To: "Giorgio Parmeggiani" <gipasoft@tisca li.it>
              From: "Giorgio Parmeggiani" <gparmeggiani@n ewsgroup.nospam >
              References: <B791758E-1F71-4EDF-BDE0-429143298715@mi crosoft.com>
              <d$plzZ9uIHA.22 40@TK2MSFTNGHUB 02.phx.gbl>
              Subject: Re: Gzip compression and SendTimeout
              Date: Thu, 22 May 2008 10:31:15 +0200
              >
              >
              Thank for your reply.
              >
              If I create a CustomBinding can I use it in my configuration file or I can
              use it only in code?
              >
              Thank
              Giorgio
              >
              "Steven Cheng [MSFT]" <stcheng@online .microsoft.comh a scritto nel
              messaggio news:d$plzZ9uIH A.2240@TK2MSFTN GHUB02.phx.gbl. ..
              >Hi Giorgio,
              >>
              >From your description, you're using the sample gzip compression binding
              >element and is wondering how to set send/receive timeout value like those
              >built-in bindings(such as basicHttpbindin g) ,correct?
              >>
              >Based on my research, the GZip compression classes the sample provided is
              >a
              >BindingEleme nt which is used as one of the binding elements of a certain
              >binding's Binding Element collection. And the BindingElement itself
              >doesn't provide "SendTimeou t" , "Receivetimeout " setting, these two
              >properties are provdied at Binding Level. Actually the built-in base
              >class
              >"Binding" has provided these two properties and other bindings like
              >basicHttpBindi ng or netTcpbinding just inhertited these two properties
              >from
              >the base class. I think you can define a custom Binding class to help
              >set
              >these values:
              >>
              >>
              >#Creating User-Defined Bindings
              >http://msdn.microsoft.com/en-us/library/ms733893.aspx
              >>
              >#How to: Create a Custom Binding Using the SecurityBinding Element
              >http://msdn.microsoft.com/en-us/library/ms730305.aspx
              >>
              >Here is the test code I used which create a custom binding class
              >programmatical ly and set the send/receive timeout properties:
              >>
              >>>>>>>>>>>>>>> >>>>>>>>>
              >static void Run()
              > {
              > string EndPointAddress = "http://localhost:8000/mathservice";
              > Uri[] baseAddresses = new Uri[1] { new Uri(EndPointAdd ress) };
              > using (ServiceHost host = new ServiceHost(typ eof(MathService ),
              >baseAddresses) )
              > {
              > host.AddService Endpoint(typeof (IMathService),
              >CreateCustomBi nding(), "");
              >>
              >>
              > ServiceMetadata Behavior smb = new
              >ServiceMetadat aBehavior();
              > smb.HttpGetEnab led = true;
              > smb.HttpGetUrl = new Uri(EndPointAdd ress);
              > host.Descriptio n.Behaviors.Add (smb);
              >>
              >>
              > host.Open();
              > Console.WriteLi ne("start...... ....");
              > Console.ReadLin e();
              >>
              >>
              > }
              >>
              >>
              >>
              > }
              >>
              > public static Binding CreateCustomBin ding()
              > {
              > // Create an empty BindingElementC ollection to populate,
              > // then create a custom binding from it.
              > BindingElementC ollection outputBec = new
              >BindingElement Collection();
              >>
              > // Create a SymmetricSecuri tyBindingElemen t.
              > SymmetricSecuri tyBindingElemen t ssbe =
              > new SymmetricSecuri tyBindingElemen t();
              >>
              > // Set the algorithm suite to one that uses 128-bit keys.
              > ssbe.DefaultAlg orithmSuite = SecurityAlgorit hmSuite.Basic12 8;
              >>
              > // Set MessageProtecti onOrder to SignBeforeEncry pt.
              > ssbe.MessagePro tectionOrder =
              >MessageProtect ionOrder.SignBe foreEncrypt;
              >>
              > // Use a Kerberos token as the protection token.
              > ssbe.Protection TokenParameters = new
              >KerberosSecuri tyTokenParamete rs();
              >>
              > // Add the SymmetricSecuri tyBindingElemen t to the
              >BindingElement Collection.
              > outputBec.Add(s sbe);
              > outputBec.Add(n ew TextMessageEnco dingBindingElem ent());
              > outputBec.Add(n ew HttpTransportBi ndingElement()) ;
              >>
              > // Create a CustomBinding and return it; otherwise, return
              >null.
              > CustomBinding cb = new CustomBinding(o utputBec);
              >>
              > cb.SendTimeout = TimeSpan.FromMi nutes(33);
              > cb.ReceiveTimeo ut = TimeSpan.FromMi nutes(33);
              >>
              >>
              > return cb;
              >>
              > }
              ><<<<<<<<<<<<<< <<<<<<<<
              >>
              >Sincerely,
              >
              >

              Comment

              Working...