In order to get WCF out the door on time, we had to make a few really painful cuts. Such things are a necessary part of shipping software, but they're never fun. Setting [AllowPartiallyTrustedCallers] on System.ServiceModel.dll to enable the use WCF in Partial Trust was definitely one of those.
Relatively speaking, we made this cut pretty early on in V1 (before WCF Beta 1). Setting APTCA is not something you do lightly, and it was pretty clear that if we ever wanted to test this thing before it went out the door, we'd have to put Partial Trust on the chopping block. So we screwed up our courage, cut the feature, and shipped V1 on time.
Now, when we did that we knew that we were making life difficult for a couple of key scenarios that we really wanted to have a good story for long-term:
- Shared hosting. Multi-tenancy (running multiple unrelated apps in different AppDomains within the same process) is standard operating procedure for shared hosting environments (think GoDaddy.com). ASP.NET's Medium Trust level was designed specifically for this scenario, and an increasing number of mass hosting providers are adopting Medium Trust as a way of keeping individual AppDomains within a process from stepping on each others toes.
- Smart Clients. It's possible to use ClickOnce technology to deploy fully trusted smart clients that can make full usage of WCF, the process requires signing your assemblies and adding the signing certificate to the Trusted Publishers store. Admittedly, it's something of a pain in the ass -- which is why in V1, many customers end up using the ASMX client stack in their ClickOnce or XBAP clients to talk to services implemented with WCF.
These two broad classes of scenarios were front an center when we were looking at the subset of WCF feature to enable in Partial Trust in Orcas.
What permission sets are we requiring?
The permission sets needed to run WCF flow directly from the scenarios I mentioned above. On the server, the price of entry is ASP.NET Medium Trust permission set. On the client, you need InternetZone permissions + WebPermission to connect back to the application's origin server (this is granted by default by both ClickOnce and XBAP).
What V1 Features work in Partial Trust?
The major V1 features supported in partial trust are the following:
- BasicHttpBinding + HTTP transport security
- TextEncoding
- Serialization with XmlSerializer
- Serialization with DataContractSerializer
- And all the min-bar stuff you'd expect from the Service Model, like the [ServiceContract]/[OperationContract] programming model, configuration, WSDL generation, etc.
Broadly speaking, we enabled the ASMX-equivalent WCF feature set + the data contract serializer.
What Orcas features work in Partial Trust?
System.ServiceModel.Web is APTCA-enabled, so everything we're doing in here works in partial trust including:
- The WebHttpBinding
- The core HTTP/POX programming model
- RSS + Atom
- JSON and ASP.NET AJAX integration
Hey Steve, why isn't (Feature X) supported?!?
As much as I would wish otherwise, the Orcas release does not come with infinite resources so we had to prioritize based on the features that were most important to the scenarios we're targeting in this release. This is an area where it would be great to get some feedback from the community about whether we've made the right calls here.
Next time around, I'll talk about the HTTP Programming Model work.
