AppliSec

Manu Cohen Yashar

February 2008 - Posts

Hosting WCF: IIS or Windows service

I have been asked many times by customers how to choose a WCF host. IIS or self host?
(A self host is usually implemented as  a windows service)

So first we have to understand that we are in the Http world because IIS is not playing in the game of other transports (excluding SMTP).

IIS has a very special life model. IIS was designed for hosting many stateless applications.

 If an application hosted by IIS is not called for x minutes (20 by default) it will be recycled.

Resource recycling is important when you host many applications but If your application holds state this can be quite sad to loose the information after 20 min.

 

IIS7.0 was designed to host many applications simultaneously. Every such application is hosted in a separate application domain. Each application domain has its own configuration and thread pool.

 IIS act as a central management point for all those applications.
It is not easy to build a host that puts all the services it hosts in separate application domains but on the other hand can continue to configure them. Remember that application domain has a clear isolation from each other (like process separation in windows)

 

IIS has a simple but effective security model. It is easily configured and is consistent with other web applications.

 

IIS has a strong configuration infrastructure. It uses a tree of configuration files. Machine.config and web.config.  Each file adds or overrides configuration to the layer above. WCF has no such thing.

IIS  can be configured using an advanced API.

All this is not easy to build.

 

IIS 7.0 is extremely extensible. You can add handlers and modules and change the pipeline.

It is not easy to create such a host yourself.

 

IIS is a deployment requirement that is sometimes not to easy to forefeel. In server scenarios usually it is not a problem but if you want a little application to be a WCF server, IIS is a no-go. Let us say you want your smart client to listen for answers another server will send (one-way messaging) this smart client should contain a ServiceHost. Now you are very happy not to use IIS. There are many other scenarios where you want a simple and clean install. You want as little pre-requisites as possible. Create your own simple host can be the solution for you.

 

IIS supports  WMI and other advanced Governance tools. It is not easy to build a host that can be governed from a central remote station. WCF does support for WMI and performance counters so this can be a starting point when you create your host, but there is no question that IIS has a lot more to offer in the governance arena.

 

To summarize:

Write down the capabilities you need. Then look what does IIS has to offer. A good host takes a lot of time to develop and test but there are many scenarios that this is what you need.   

  Manu 

 

      

 

Serializable Dictionary

Serializable Dictionary

I wanted to use a dictionary<T>  to create a MSMQ message but I found that a dictionary is not serializable. I spoke to a good friend “Adar Wesley” and he gave me the code of a Serializable Dictionary<T> he wrote. So here it is.

Enjoy.

Download:

SerializableDictionary

 

Come to my talk at Tech-Ed 2008 Eilat

SOA is an enabler for faster process change,

greater business insight and competitive advantage,

and the creation of a new generation of dynamic applications


The question is how to implement the SOA promise.

SOA has a price. When implementing SOA based solutions many challenges must be faced.

It turns out that a lot infrastructure and architectural wisdom is needed to make the
SOA promise a come true.

 

Using a real life scenario we will define the SOA promise and introduce
various types of infrastructure that helps us implement different
aspects the architecture

 

We will understand the scope of each infrastructure, and learn how to choose
the right one for us.

 

In this talk we will describe the infrastructure needs of different kinds of organizations, from simple to very large scale organizations.

We will cover Connectivity, Modeling and workflows, Service Bus (enterprise and internet scopes), S+S, Human interaction and Service Governance and understand how all these fit together.

 

You can see a promo at:

http://webcast.you-niversity.com/quickdemo/?2_16_2008-9_6_34

manu