One or more AppDomains created on the server side when multiple clients are calling WCF service?

The question is pretty much in the title, but I'll clarify.

I have a Silverlight application that acts like a slightly advanced UI.

The bulk of my program will run on a server to provide a shared collaborative database.

This is where my question comes in: Will the two clients calling a WCF service receive a stream inside that service, or will they each receive a full AppDomain?

The difference is that if the first case, they can easily split the DB, but in the second scenario they cannot - as I understand it.

EDIT: This is because the database uses the identity map template [Fowler] where the objects used are stored in physical memory (static singleton variable) - multiple AppDomains can mess up this.

(I asked my university professor and searched a bit before asking this seemingly simple question)

+3


source to share


1 answer


The threading model for WCF services is defined by the ConcurrencyMode parameter that you configure for your service: http://msdn.microsoft.com/en-us/library/system.servicemodel.concurrencymode.aspx .

Regarding AppDomains, it depends entirely on how you host your service. If you use your own ServiceHost, manually, there will always be exactly 1 AppDomain on the server, unless you decide to start managing and deploying your own.



If you host inside IIS ... it's up to IIS how it handles requests. It can reuse 1 AppDomain, it can deploy multiple AppDomains (unless you override the setting in web.config to only allow 1 AppDomain per worker process), or it can deploy multiple physical worker processes (which inherently implies multiple AppDomains) if you have Web Garden Mode enabled.

All that said, I don't know exactly why it would affect your data access strategy. Multiple threads or AppDomains shouldn't have a problem sharing the database.

+1


source







All Articles