Sandrino Di Mattia

Content-type: Microsoft

Social

Follow me on Twitter! LinkedIn! RSS! SilverlightShow Contributor

Recent posts

Tags

Categories

Archive

Blogroll

Solving issue in WCF: 'There are too many pending secure conversations on the server'

For an internet facing service I noticed the following issue: There are too many pending secure conversations on the server
That's one that slipped through the unit tests...

Solution:

<behaviors>

  <serviceBehaviors>

    <behavior name="serviceBehavior">

      <serviceThrottling maxConcurrentCalls="1000" maxConcurrentSessions="1000" maxConcurrentInstances="1000" />

    </behavior>

  </serviceBehaviors>

</behaviors>

Just modify the limits of your service behavior.

Important: Don't just put any high number there. These limits should be adapted to your needs.
Read why in the following blog post: http://kennyw.com/indigo/150

Posted: Sep 21 2009, 11:56 by Sandrino | Comments (0) RSS comment feed |
Filed under: Development

A list of all available DevExpress skins and how to apply/install them

The DevExpress support site shows how to install some skins.
But what are all the available skins (for example in the new release DevExpress 9.2)?

Available skins (these are the correct names to use in your code)

DevExpress.BonusSkins.v9.2

  1. Coffee
  2. Liquid Sky
  3. London Liquid Sky
  4. Glass Oceans
  5. Stardust
  6. Xmas 2008 Blue
  7. Valentine
  8. McSkin
  9. Summer 2008
  10. Pumpkin
  11. Dark Side
  12. Springtime
  13. Darkroom
  14. Foggy
  15. High Contrast
  16. Seven
  17. Seven Classic
  18. Sharp
  19. Sharp Plus

DevExpress.OfficeSkins.v9.2

  1. Office 2007 Blue
  2. Office 2007 Black
  3. Office 2007 Silver
  4. Office 2007 Green
  5. Office 2007 Pink

Installing the skins

First be sure to add a reference to DevExpress.BonusSkins.v9.2 and/or DevExpress.OfficeSkins.v9.2.
After that you can just do the following:

DefaultLookAndFeel defaultSkin = new DefaultLookAndFeel();

defaultSkin.LookAndFeel.SetSkinStyle("Seven");

The name of the skin  you want to load should be passed as a string.
After you've done that your whole application will be using this skin (except if you have set UseDefaultLookAndFeel to false).

Posted: Sep 03 2009, 11:57 by Sandrino | Comments (0) RSS comment feed |
Filed under: Development

WCF and fixing client/host time issues (MaxClockSkew) quickly

I have noticed that some of my WCF clients suddenly had issues connecting.
These were the exceptions:

  • The security timestamp is stale because its expiration time is in the past.
  • An error occurred when verifying security for the message

The problem was that the server time had a difference of +/- 10 min. with the clients that had problems.
Since these clients are not part of the domain at all we had a problem, since WCF only allows a 5 min. difference.

This could "easely" be solved with:

  • LocalClientSettings.MaxClockSkew
  • LocalServiceSettings.MaxClockSkew

But this is only supported by custom bindings.
Custom binding doesn't support properties like readerQuotas ... so this creates a new problem.
You could for example add tcpTransport in your custom binding but here again not all the properties are available.
And I'm actually not a fan of having to rewrite all my bindings.

That's why I liked the following solution (note, this is only when you host your service in an application/service):

ServiceHost service = new ServiceHost(typeof(Calculator));

Binding currentBinding = service.Description.Endpoints[0].Binding;

With this code we get our current binding (presuming the endpoints and bindings are in the App.config).
Then we just have to update the current binding with a custom binding:

// Set the maximum difference in minutes

int maxDifference = 300;

 

// Create a custom binding based on an existing binding

CustomBinding myCustomBinding = new CustomBinding(currentBinding);

 

// Set the maxClockSkew

var security = myCustomBinding.Elements.Find<SymmetricSecurityBindingElement>();

security.LocalClientSettings.MaxClockSkew = TimeSpan.FromMinutes(maxDifference);

security.LocalServiceSettings.MaxClockSkew = TimeSpan.FromMinutes(maxDifference);

 

// Set the maxClockSkew

var secureTokenParams = (SecureConversationSecurityTokenParameters)security.ProtectionTokenParameters;

var bootstrap = secureTokenParams.BootstrapSecurityBindingElement;

bootstrap.LocalClientSettings.MaxClockSkew = TimeSpan.FromMinutes(maxDifference);

bootstrap.LocalServiceSettings.MaxClockSkew = TimeSpan.FromMinutes(maxDifference);

 

// Update the binding of the endpoint

service.Description.Endpoints[0].Binding = myCustomBinding;

The only thing we had to do is create a custom binding based on an existing binding.
After that we adapted the maxClockSkew on the required objects and then injected the new binding back to the endpoint.

If you have multiple endpoints you should apply this on all your endpoints.

Posted: Sep 03 2009, 11:55 by Sandrino | Comments (0) RSS comment feed |
Filed under: Development