This project is read-only.

Enhancement: Expose Host AppDomain


We have started using CassiniDev in an internal project (great tool by the way!). We are using it in conjunction with Watin and FirefoxPortable to do web UI testing.
We had an issue that required access to the hosted AppDomain. We needed to modify some comms behaviour within the virtual directory. We had a static class that we wanted to instantiate with some injected behaviour to ensure testing was possible without a full service stack.
To enable this, we exposed a property on Host to provide the AppDomain.CurrentDomain, and exposed this via a property on the Server called HostAppDomain. We wrap this in a modified CassiniDevServer class so that we can write code such as:
Server _server = new Server(..);
StaticType remoteObject = (StaticType)_server.HostAppDomain.CreateInstanceAndUnwrap("Assembly.Type.Exists.In","NameSpace.To.StaticType");
remoteObject.ExecuteMethod("Running in AppDomain for VirtualDirectory");
Attached are the changes required (there were a few other properties added that we found useful). Not sure if there is an easier way to achieve what we were trying to do, happy to discuss. Would be great if this ability could be provided in the trunk though... :)
PS Apologies about zip file, couldn't attach more than one file???? (sigh)

file attachments


Sky wrote Jun 11, 2012 at 9:18 AM

thank you for your contribution. it will be included in the next push.

wrote Jun 11, 2012 at 9:19 AM

wrote Feb 22, 2013 at 12:19 AM