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