I'm working on an ASP.NET app, and we want to add the ability to call customer script during some of the requests. Since we don't trust this script, we are spawning a child AppDomain inside of our IIS request which has limited permissions, and loading both the customer assembly and a Script Runner assembly. The customer script can do things like change the description of a business object or change a status code to an error if certain criteria are met. Because the changes are so varied, I can't encompass them in a single object that gets returned from a method call. As the script is running, I need it to alter values in objects inside of the Request that launched this child.
This post recommends using NetNamedPipeBinding, but I'm growing concerned that it isn't appropriate for code running inside of IIS where multiple requests could be running concurrently. Would I set up a new host for each IIS request? Set up a static host for the entire process, and then use endpoints to make sure that the correct child talks with the correct request? Is this the right technology?
If this isn't the right technology, what is? This post tells you how to retrieve the handle of the parent AppDomain, but many of those seem to use mscoree.dll, and generally I was under the impression that COM and IIS didn't mix terribly well. This post talks about wiping out your initial AppDomain and creating a new one. Perhaps that's not necessary in IIS?
Is there a way for a child AppDomain to efficiently execute methods inside of the Request object that spawned it, and if so what is it?