473,395 Members | 1,466 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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 3259
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Xah Lee | last post by:
today i need to use Python to decompress gzip files. since i'm familiar with Python doc and have 10 years of computing experience with 4 years in unix admin and perl, i have quickly located the...
25
by: Xah Lee | last post by:
Python Doc Problem Example: gzip Xah Lee, 20050831 Today i need to use Python to compress/decompress gzip files. Since i've read the official Python tutorial 8 months ago, have spent 30...
4
by: Anders K. Jacobsen [DK] | last post by:
Hi Does anyone have experience using gZip compression on the IIS server with a ASP.NET application. How much can a page be compressed. As i see it it must have a huge impact on the total size....
1
by: sameer | last post by:
Hi All, I am adding a custom header (Gzip header for compression) to the request when calling a webservice( sitting on a webserver) over the internet from my application ( If interested in the...
2
by: .nLL | last post by:
hi. i have recently enabled gzip compression on my server and it works fine. but i have noticed something wierd. To protect my self from hotlinking i use a simple code to send my download with...
2
by: Chaos | last post by:
I have tried to search Google, but I cannot seem to find a library to decompress a gzip string or char to a string or char. I want to write something that allows libcurl to access a page, save the...
2
by: Carlo Razzeto | last post by:
Hello there, I'm having an odd issue with GZIP compression (having followed example code found on MSDN). Basically, after running through the compression routine I end up with a byte array...
3
by: Sean Davis | last post by:
I have a set of numpy arrays which I would like to save to a gzip file. Here is an example without gzip: b=numpy.ones(1000000,dtype=numpy.uint8) a=numpy.zeros(1000000,dtype=numpy.uint8) fd =...
6
by: pooppoop | last post by:
Hi, and thanks for viewing my post. i have an odd result when trying to compress and decompress a string. it seems that when i replace the Zero's in the input stream it works, if not the string...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.