Here I will post problems I and my colleagues met and solutions we found.

Tuesday, February 17, 2009

Flickering in WinForms

I used to know these things long time ago. But later, with .NET programming they faded in my memory and it took me more than an hour (I will not tell you how much more) of experimenting to discover it again.

When your screen is flickering, check if DoubleBuffered is on. It may help.

Sunday, February 15, 2009

Implementing netTcpBinding in WCF and security

Usually I post when I solve some problem. I didn't solve this one yet, but was almost there.

We decided to build n-tier application using CSLA. So, this is a desktop WPF application, we just host a server with business objects and desktop client access the server through Internet. I wanted to use WCF for communication. Also, I wanted to host it in my own windows service, not by IIS. Additionally, I wanted to use TCP binding, as it is supposedly faster, if I understand correctly, which is another reason to not use IIS.

It looked very simple, like all I had to do is to change binding to NetTcpBinding. And first, it worked fine until I tried to connect from my home computer, which wasn't member of our Windows domain. It looked that for some reason connection was terminated by the host. The error message did not give me any specifics. Using SvcTraceViewer.exe I identified the problem as related to the security.

Making the long story short, I found this blog post to be the best to help me with my problem. The last step of getting certificate value did not work for me, and the project is on hold now. I hope I will find the time to resolve everything.

Now, let me explain in few words what the problem is. All bindings with exceptions of BasicHttpBinding require some kind of security on the transport level. So, we have to create certificate and apply it somehow. We could register it in the Windows, but I didn't want to go this way.

Another problem is authentication. If I hosted service under IIS, that would provide some mechanism, but this is not what I wanted. To help with that I decided to use custom username authentication. And this is also covered very well in post I found.