Hi Ryan,
I have run into another issue in relation to this post. In my original problem description when I mentioned the application, it is an add-in for Excel, thus a DLL( implemented via VSTO in C# ). When I connected Cassini to the add-in via adding a reference as described above, I get the error
System.SystemException was unhandled
Message="Failed to create AppDomain."
Source="System.Web"
StackTrace:
at System.Web.Hosting.ApplicationManager.CreateAppDomainWithHostingEnvironment(String appId, IApplicationHost appHost, HostingEnvironmentParameters hostingParameters)
at System.Web.Hosting.ApplicationManager.CreateAppDomainWithHostingEnvironmentAndReportErrors(String appId, IApplicationHost appHost, HostingEnvironmentParameters hostingParameters)
at System.Web.Hosting.ApplicationManager.GetAppDomainWithHostingEnvironment(String appId, IApplicationHost appHost, HostingEnvironmentParameters hostingParameters)
at System.Web.Hosting.ApplicationManager.CreateObjectInternal(String appId, Type type, IApplicationHost appHost, Boolean failIfExists, HostingEnvironmentParameters hostingParameters)
at System.Web.Hosting.ApplicationManager.CreateObject(String appId, Type type, String virtualPath, String physicalPath, Boolean failIfExists, Boolean throwOnError)
at System.Web.Hosting.ApplicationManager.CreateObject(String appId, Type type, String virtualPath, String physicalPath, Boolean failIfExists)
at Cassini.Server.GetHost()
at Cassini.Server.OnSocketAccept(Object acceptedSocket)
at System.Threading._ThreadPoolWaitCallback.WaitCallback_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallbackInternal(_ThreadPoolWaitCallback tpWaitCallBack)
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback(Object state)
InnerException: System.NullReferenceException
Message="Object reference not set to an instance of an object."
Source="System.Web"
StackTrace:
at System.Web.Hosting.ApplicationManager.GetDefaultDomainIdentity()
at System.Web.Hosting.ApplicationManager.CreateAppDomainWithHostingEnvironment(String appId, IApplicationHost appHost, HostingEnvironmentParameters hostingParameters)
InnerException:
So to make sure I had not created a new error somehow, I took the test code I used in my winform application which works correctly under XP & Vista and moved it into a new empty VSTO add-in and ran it under Excel and I get the same app domain error as above. Thus the same code works in an winform exe, but not in the Excel addin DLL. I have looked for info in the forum on using Cassini from a DLL but did not find anything that looked promising. Is there a requiment it must be hosted via WinForms application???? The DLL created by VSTO is simliar to a class libary but not the same as a class libary.