Export to GitHub

aspnetserve - issue #11

Remove GAC Install Dependency


Posted on Jul 16, 2008 by Happy Kangaroo

Currently aspNETserve.Core must be registered in the GAC before the server can start. This is due to the use of the CreateObject method on the System.Web.Hosting.ApplicationManager object to create the aspNETserve.Core.DomainHook object in the hosted AppDomain.

Perhaps another implementation can be found that removes the need to install any components in the GAC.

Comment #1

Posted on Aug 17, 2008 by Happy Kangaroo

assigning this issue to release 1.3.1

Comment #2

Posted on Sep 24, 2008 by Happy Kangaroo

After long investigation, I see no easy way to properly remove the GAC dependency. So, for the time being, I am putting this ticket on hold.

As a interim solution checkout: http://jason.whitehorn.ws/2008/08/24/aspNETserve+Without+GAC+Install.aspx

Comment #3

Posted on Nov 21, 2008 by Massive Ox

To get around the GAC, see the hack used by the latest Cassini drop: http://blogs.msdn.com/dmitryr/archive/2008/10/03/cassini-for-framework-3-5.aspx

In particular, check out CreateWorkerAppDomainWithHost in Server.cs. Here's the bit which may help you as well:

/* ****************************************************************************** * * Copyright (c) Microsoft Corporation. All rights reserved. * * This source code is subject to terms and conditions of the Microsoft Public * License (Ms-PL). A copy of the license can be found in the license.htm file * included in this distribution. * * You must not remove this notice, or any other, from this software. * * ******************************************************************************/

static object CreateWorkerAppDomainWithHost(string virtualPath, string physicalPath, Type hostType) { // this creates worker app domain in a way that host doesn't need to be in GAC or bin // using BuildManagerHost via private reflection var uniqueAppString = string.Concat(virtualPath, physicalPath).ToLowerInvariant (); var appId = (uniqueAppString.GetHashCode()).ToString("x", CultureInfo.InvariantCulture);

// create BuildManagerHost in the worker app domain
var appManager = ApplicationManager.GetApplicationManager();
var buildManagerHostType = typeof(HttpRuntime).Assembly.GetType

("System.Web.Compilation.BuildManagerHost"); var buildManagerHost = appManager.CreateObject(appId, buildManagerHostType, virtualPath, physicalPath, false);

// call BuildManagerHost.RegisterAssembly to make Host type loadable in the 

worker app domain buildManagerHostType.InvokeMember( "RegisterAssembly", BindingFlags.Instance | BindingFlags.InvokeMethod | BindingFlags.NonPublic, null, buildManagerHost, new object[] { hostType.Assembly.FullName, hostType.Assembly.Location });

// create Host in the worker app domain
return appManager.CreateObject(appId, hostType, virtualPath, physicalPath, 

false); }

Status: OnHold

Labels:
Type-Enhancement Priority-Medium