468,758 Members | 2,073 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,758 developers. It's quick & easy.

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

Jun 27 '08 #1
6 3017
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 basicHttpbinding) ,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 "SendTimeout" , "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
basicHttpBinding 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 SecurityBindingElement
http://msdn.microsoft.com/en-us/library/ms730305.aspx

Here is the test code I used which create a custom binding class
programmatically and set the send/receive timeout properties:
>>>>>>>>>>>>>>>>>>>>>>
static void Run()
{
string EndPointAddress = "http://localhost:8000/mathservice";
Uri[] baseAddresses = new Uri[1] { new Uri(EndPointAddress) };
using (ServiceHost host = new ServiceHost(typeof(MathService),
baseAddresses))
{
host.AddServiceEndpoint(typeof(IMathService),
CreateCustomBinding(), "");
ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
smb.HttpGetEnabled = true;
smb.HttpGetUrl = new Uri(EndPointAddress);
host.Description.Behaviors.Add(smb);
host.Open();
Console.WriteLine("start..........");
Console.ReadLine();
}

}

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

// Create a SymmetricSecurityBindingElement.
SymmetricSecurityBindingElement ssbe =
new SymmetricSecurityBindingElement();

// Set the algorithm suite to one that uses 128-bit keys.
ssbe.DefaultAlgorithmSuite = SecurityAlgorithmSuite.Basic128;

// Set MessageProtectionOrder to SignBeforeEncrypt.
ssbe.MessageProtectionOrder =
MessageProtectionOrder.SignBeforeEncrypt;

// Use a Kerberos token as the protection token.
ssbe.ProtectionTokenParameters = new
KerberosSecurityTokenParameters();

// Add the SymmetricSecurityBindingElement to the
BindingElementCollection.
outputBec.Add(ssbe);
outputBec.Add(new TextMessageEncodingBindingElement());
outputBec.Add(new HttpTransportBindingElement());

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

cb.SendTimeout = TimeSpan.FromMinutes(33);
cb.ReceiveTimeout = TimeSpan.FromMinutes(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:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
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" <gi******@tiscali.it>
From: "Giorgio Parmeggiani" <gp**********@newsgroup.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
Jun 27 '08 #2
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]" <st*****@online.microsoft.comha scritto nel
messaggio news:d$**************@TK2MSFTNGHUB02.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 basicHttpbinding) ,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 "SendTimeout" , "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
basicHttpBinding 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 SecurityBindingElement
http://msdn.microsoft.com/en-us/library/ms730305.aspx

Here is the test code I used which create a custom binding class
programmatically and set the send/receive timeout properties:
>>>>>>>>>>>>>>>>>>>>>>>
static void Run()
{
string EndPointAddress = "http://localhost:8000/mathservice";
Uri[] baseAddresses = new Uri[1] { new Uri(EndPointAddress) };
using (ServiceHost host = new ServiceHost(typeof(MathService),
baseAddresses))
{
host.AddServiceEndpoint(typeof(IMathService),
CreateCustomBinding(), "");
ServiceMetadataBehavior smb = new
ServiceMetadataBehavior();
smb.HttpGetEnabled = true;
smb.HttpGetUrl = new Uri(EndPointAddress);
host.Description.Behaviors.Add(smb);
host.Open();
Console.WriteLine("start..........");
Console.ReadLine();
}

}

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

// Create a SymmetricSecurityBindingElement.
SymmetricSecurityBindingElement ssbe =
new SymmetricSecurityBindingElement();

// Set the algorithm suite to one that uses 128-bit keys.
ssbe.DefaultAlgorithmSuite = SecurityAlgorithmSuite.Basic128;

// Set MessageProtectionOrder to SignBeforeEncrypt.
ssbe.MessageProtectionOrder =
MessageProtectionOrder.SignBeforeEncrypt;

// Use a Kerberos token as the protection token.
ssbe.ProtectionTokenParameters = new
KerberosSecurityTokenParameters();

// Add the SymmetricSecurityBindingElement to the
BindingElementCollection.
outputBec.Add(ssbe);
outputBec.Add(new TextMessageEncodingBindingElement());
outputBec.Add(new HttpTransportBindingElement());

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

cb.SendTimeout = TimeSpan.FromMinutes(33);
cb.ReceiveTimeout = TimeSpan.FromMinutes(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:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
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" <gi******@tiscali.it>
From: "Giorgio Parmeggiani" <gp**********@newsgroup.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

Jun 27 '08 #3
Hi Giorgio,

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

<binding name="BufferedHttpSampleServer" SendTimeout="00:33:00">

<gzipMessageEncoding innerMessageEncoding="textMessageEncoding" />
.................

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

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:
ms****@microsoft.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" <gi******@tiscali.it>
From: "Giorgio Parmeggiani" <gp**********@newsgroup.nospam>
References: <B7**********************************@microsoft.co m>
<d$**************@TK2MSFTNGHUB02.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]" <st*****@online.microsoft.comha scritto nel
messaggio news:d$**************@TK2MSFTNGHUB02.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 basicHttpbinding) ,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 "SendTimeout" , "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
basicHttpBinding 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 SecurityBindingElement
http://msdn.microsoft.com/en-us/library/ms730305.aspx

Here is the test code I used which create a custom binding class
programmatically and set the send/receive timeout properties:
>>>>>>>>>>>>>>>>>>>>>>>
static void Run()
{
string EndPointAddress = "http://localhost:8000/mathservice";
Uri[] baseAddresses = new Uri[1] { new Uri(EndPointAddress) };
using (ServiceHost host = new ServiceHost(typeof(MathService),
baseAddresses))
{
host.AddServiceEndpoint(typeof(IMathService),
CreateCustomBinding(), "");
ServiceMetadataBehavior smb = new
ServiceMetadataBehavior();
smb.HttpGetEnabled = true;
smb.HttpGetUrl = new Uri(EndPointAddress);
host.Description.Behaviors.Add(smb);
host.Open();
Console.WriteLine("start..........");
Console.ReadLine();
}

}

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

// Create a SymmetricSecurityBindingElement.
SymmetricSecurityBindingElement ssbe =
new SymmetricSecurityBindingElement();

// Set the algorithm suite to one that uses 128-bit keys.
ssbe.DefaultAlgorithmSuite = SecurityAlgorithmSuite.Basic128;

// Set MessageProtectionOrder to SignBeforeEncrypt.
ssbe.MessageProtectionOrder =
MessageProtectionOrder.SignBeforeEncrypt;

// Use a Kerberos token as the protection token.
ssbe.ProtectionTokenParameters = new
KerberosSecurityTokenParameters();

// Add the SymmetricSecurityBindingElement to the
BindingElementCollection.
outputBec.Add(ssbe);
outputBec.Add(new TextMessageEncodingBindingElement());
outputBec.Add(new HttpTransportBindingElement());

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

cb.SendTimeout = TimeSpan.FromMinutes(33);
cb.ReceiveTimeout = TimeSpan.FromMinutes(33);
return cb;

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

Sincerely,
Jun 27 '08 #4
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:
ms****@microsoft.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: st*****@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:
>>>>>>>>>>>>>
<customBinding>

<binding name="BufferedHttpSampleServer" SendTimeout="00:33:00">

<gzipMessageEncoding innerMessageEncoding="textMessageEncoding" />
.................

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

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:
ms****@microsoft.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" <gi******@tiscali.it>
From: "Giorgio Parmeggiani" <gp**********@newsgroup.nospam>
References: <B7**********************************@microsoft.co m>
<d$**************@TK2MSFTNGHUB02.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]" <st*****@online.microsoft.comha scritto nel
messaggio news:d$**************@TK2MSFTNGHUB02.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 basicHttpbinding) ,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 "SendTimeout" , "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
basicHttpBinding 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 SecurityBindingElement
http://msdn.microsoft.com/en-us/library/ms730305.aspx

Here is the test code I used which create a custom binding class
programmatically and set the send/receive timeout properties:
>>>>>>>>>>>>>>>>>>>>>>>
static void Run()
{
string EndPointAddress = "http://localhost:8000/mathservice";
Uri[] baseAddresses = new Uri[1] { new Uri(EndPointAddress) };
using (ServiceHost host = new ServiceHost(typeof(MathService),
baseAddresses))
{
host.AddServiceEndpoint(typeof(IMathService),
CreateCustomBinding(), "");
ServiceMetadataBehavior smb = new
ServiceMetadataBehavior();
smb.HttpGetEnabled = true;
smb.HttpGetUrl = new Uri(EndPointAddress);
host.Description.Behaviors.Add(smb);
host.Open();
Console.WriteLine("start..........");
Console.ReadLine();
}

}

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

// Create a SymmetricSecurityBindingElement.
SymmetricSecurityBindingElement ssbe =
new SymmetricSecurityBindingElement();

// Set the algorithm suite to one that uses 128-bit keys.
ssbe.DefaultAlgorithmSuite = SecurityAlgorithmSuite.Basic128;

// Set MessageProtectionOrder to SignBeforeEncrypt.
ssbe.MessageProtectionOrder =
MessageProtectionOrder.SignBeforeEncrypt;

// Use a Kerberos token as the protection token.
ssbe.ProtectionTokenParameters = new
KerberosSecurityTokenParameters();

// Add the SymmetricSecurityBindingElement to the
BindingElementCollection.
outputBec.Add(ssbe);
outputBec.Add(new TextMessageEncodingBindingElement());
outputBec.Add(new HttpTransportBindingElement());

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

cb.SendTimeout = TimeSpan.FromMinutes(33);
cb.ReceiveTimeout = TimeSpan.FromMinutes(33);
return cb;

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

Sincerely,

Jun 27 '08 #5
Yes

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

Thank for your suggestions

"Steven Cheng [MSFT]" <st*****@online.microsoft.comha scritto nel
messaggio news:OO**************@TK2MSFTNGHUB02.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:
ms****@microsoft.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: st*****@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:
>>>>>>>>>>>>>>
<customBinding>

<binding name="BufferedHttpSampleServer" SendTimeout="00:33:00">

<gzipMessageEncoding innerMessageEncoding="textMessageEncoding"
/>
................

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

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:
ms****@microsoft.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" <gi******@tiscali.it>
From: "Giorgio Parmeggiani" <gp**********@newsgroup.nospam>
References: <B7**********************************@microsoft.co m>
<d$**************@TK2MSFTNGHUB02.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]" <st*****@online.microsoft.comha scritto nel
messaggio news:d$**************@TK2MSFTNGHUB02.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 basicHttpbinding) ,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 "SendTimeout" , "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
basicHttpBinding 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 SecurityBindingElement
http://msdn.microsoft.com/en-us/library/ms730305.aspx

Here is the test code I used which create a custom binding class
programmatically and set the send/receive timeout properties:
>>>>>>>>>>>>>>>>>>>>>>>>
static void Run()
{
string EndPointAddress = "http://localhost:8000/mathservice";
Uri[] baseAddresses = new Uri[1] { new Uri(EndPointAddress) };
using (ServiceHost host = new ServiceHost(typeof(MathService),
baseAddresses))
{
host.AddServiceEndpoint(typeof(IMathService),
CreateCustomBinding(), "");
ServiceMetadataBehavior smb = new
ServiceMetadataBehavior();
smb.HttpGetEnabled = true;
smb.HttpGetUrl = new Uri(EndPointAddress);
host.Description.Behaviors.Add(smb);
host.Open();
Console.WriteLine("start..........");
Console.ReadLine();
}

}

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

// Create a SymmetricSecurityBindingElement.
SymmetricSecurityBindingElement ssbe =
new SymmetricSecurityBindingElement();

// Set the algorithm suite to one that uses 128-bit keys.
ssbe.DefaultAlgorithmSuite = SecurityAlgorithmSuite.Basic128;

// Set MessageProtectionOrder to SignBeforeEncrypt.
ssbe.MessageProtectionOrder =
MessageProtectionOrder.SignBeforeEncrypt;

// Use a Kerberos token as the protection token.
ssbe.ProtectionTokenParameters = new
KerberosSecurityTokenParameters();

// Add the SymmetricSecurityBindingElement to the
BindingElementCollection.
outputBec.Add(ssbe);
outputBec.Add(new TextMessageEncodingBindingElement());
outputBec.Add(new HttpTransportBindingElement());

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

cb.SendTimeout = TimeSpan.FromMinutes(33);
cb.ReceiveTimeout = TimeSpan.FromMinutes(33);
return cb;

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

Sincerely,

Jun 27 '08 #6
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:
ms****@microsoft.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" <gi******@tiscali.it>
From: "Giorgio Parmeggiani" <gp**********@newsgroup.nospam>
References: <B7**********************************@microsoft.co m>
<d$**************@TK2MSFTNGHUB02.phx.gbl>
<5C**********************************@microsoft.co m>
<TU**************@TK2MSFTNGHUB02.phx.gbl>
<OO**************@TK2MSFTNGHUB02.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]" <st*****@online.microsoft.comha scritto nel
messaggio news:OO**************@TK2MSFTNGHUB02.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:
ms****@microsoft.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: st*****@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:
>>>>>>>>>>>>>>
<customBinding>

<binding name="BufferedHttpSampleServer" SendTimeout="00:33:00">

<gzipMessageEncoding innerMessageEncoding="textMessageEncoding"
/>
................

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

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:
ms****@microsoft.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" <gi******@tiscali.it>
From: "Giorgio Parmeggiani" <gp**********@newsgroup.nospam>
References: <B7**********************************@microsoft.co m>
<d$**************@TK2MSFTNGHUB02.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]" <st*****@online.microsoft.comha scritto nel
messaggio news:d$**************@TK2MSFTNGHUB02.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 basicHttpbinding) ,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 "SendTimeout" , "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
basicHttpBinding 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 SecurityBindingElement
http://msdn.microsoft.com/en-us/library/ms730305.aspx

Here is the test code I used which create a custom binding class
programmatically and set the send/receive timeout properties:
>>>>>>>>>>>>>>>>>>>>>>>>
static void Run()
{
string EndPointAddress = "http://localhost:8000/mathservice";
Uri[] baseAddresses = new Uri[1] { new Uri(EndPointAddress) };
using (ServiceHost host = new ServiceHost(typeof(MathService),
baseAddresses))
{
host.AddServiceEndpoint(typeof(IMathService),
CreateCustomBinding(), "");
ServiceMetadataBehavior smb = new
ServiceMetadataBehavior();
smb.HttpGetEnabled = true;
smb.HttpGetUrl = new Uri(EndPointAddress);
host.Description.Behaviors.Add(smb);
host.Open();
Console.WriteLine("start..........");
Console.ReadLine();
}

}

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

// Create a SymmetricSecurityBindingElement.
SymmetricSecurityBindingElement ssbe =
new SymmetricSecurityBindingElement();

// Set the algorithm suite to one that uses 128-bit keys.
ssbe.DefaultAlgorithmSuite = SecurityAlgorithmSuite.Basic128;

// Set MessageProtectionOrder to SignBeforeEncrypt.
ssbe.MessageProtectionOrder =
MessageProtectionOrder.SignBeforeEncrypt;

// Use a Kerberos token as the protection token.
ssbe.ProtectionTokenParameters = new
KerberosSecurityTokenParameters();

// Add the SymmetricSecurityBindingElement to the
BindingElementCollection.
outputBec.Add(ssbe);
outputBec.Add(new TextMessageEncodingBindingElement());
outputBec.Add(new HttpTransportBindingElement());

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

cb.SendTimeout = TimeSpan.FromMinutes(33);
cb.ReceiveTimeout = TimeSpan.FromMinutes(33);
return cb;

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

Sincerely,

Jun 27 '08 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

10 posts views Thread by Xah Lee | last post: by
4 posts views Thread by Anders K. Jacobsen [DK] | last post: by
2 posts views Thread by .nLL | last post: by
2 posts views Thread by Carlo Razzeto | last post: by
3 posts views Thread by Sean Davis | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.