Re: GAC Alternative
Brought to you by:
wrowe
From: Electronjockey <ele...@ho...> - 2010-02-25 13:29:08
|
I added a routine inside the ConnectHost method just before the newHost gets created. I'm not certain this is the best place to put it, and I'm still not happy with the idea of multiple copies. However, most of the articles/blogs I've turned up so far go down this road, because ASP.Net 2.0 requires the assembly that creates the appdomain to be in that app's bin. I just found a CLR Team blog that may take me down another road, but for now the copy routine works. If I'm stuck with this then I have to clean up the code and do things like check to see if Apache.Web.dll isn't already in the GAC, attempt to register it if it isn't, and failing that copy itself to the configured app's bin if it doesn't already exist there (same version). -----Original Message----- From: Electronjockey <ele...@ho...> To : mod...@li... Sent: Wed Feb 24 9:52:05 2010 Subject: Re: GAC Alternative It must have been some kind of mis-configuration on my part, but this morning the dual copy method seems to be working. I have two mapped applications in the same host, each with a copy of Apache.Web.dll in their \bin (as well as in <APACHE_PATH>\bin. As I mentioned before, this is not necessarily ideal, but it is functional. I was reading a thread concerning working with ApplicationHost.CreateApplicationHost and the developer to overcome this problem implemented a copy method that copied the initiating dll into the application's \bin. I may do something similar in HostFactory.h as part of the call to CreateHost. I'm working with source mod_aspdotnet2_20070817 building in VS 2008 targeting the .Net 2.0 framework. -----Original Message----- From: Electronjockey <ele...@ho...> To : mod...@li... Sent: Tue Feb 23 10:21:50 2010 Subject: Re: GAC Alternative More notes, So far this dual copy of Apache.Web.dll only seems to work if there is only one mapped app, i.e. there is only one secondary \bin copy. This I'm sure has something to do with the AppDomain created by ApplicationHost.CreateApplicationHost which is why it would normally be in the GAC. -----Original Message----- From: Electronjockey <ele...@ho...> To : mod...@li... and mod...@li... Sent: Mon Feb 22 11:30:00 2010 Subject: Re: GAC Alternative This mornings research and experimentation has produced an interesting result. If I place Apache.Web.dll in just the <APACHE_PATH>\bin the following error occurs on Apache startup: mod_aspdotnet: System.IO.FileNotFoundException: Could not load file or assembly 'Apache.Web, Version=2.2.0.2199, Culture=neutral, PublicKeyToken=9b9b842f49b86351' or one of its dependencies. The system cannot find the file specified. File name: 'Apache.Web, Version=2.2.0.2199, Culture=neutral, PublicKeyToken=9b9b842f49b86351' at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) at System.Reflection.Assembly.Load(String assemblyString) at System.UnitySerializationHolder.GetRealObject(StreamingContext context) at System.Web.Hosting.HostingEnvironment.CreateInstance(Type type) at System.Web.Hosting.ApplicationManager.CreateInstanceInNewWorkerAppDomain(Type type, String appId, VirtualPath virtualPath, String physicalPath) at System.Web.Hosting.ApplicationHost.CreateApplicationHost(Type hostType, String virtualDir, String physicalDir) at Apache.Web.HostFactory.ConnectHost(Int32 HostKey) If I place Apahce.Web.dll in the configured appliction's \bin, as expected Apache errors out on startup with the following: [Mon Feb 22 11:22:52 2010] [error] (-2146304894)Unknown error: mod_aspdotnet: Could not create the .NET interface for the Apache.Web.HostFactory. [Mon Feb 22 11:22:52 2010] [crit] (-2146304894)Unknown error: mod_aspdotnet: Failed to start Asp.Net Apache.Web host factory Configuration Failed Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'Apache.Web, Version=2.2.0.2199, Culture=neutral, PublicKeyToken=9b9b842f49b86351' or one of its dependencies. The system cannot find the file specified. File name: 'Apache.Web, Version=2.2.0.2199, Culture=neutral, PublicKeyToken=9b9b842f49b86351' at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) at System.Activator.CreateInstance(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo, StackCrawlMark& stackMark) at System.Activator.CreateInstance(String assemblyName, String typeName) at System.AppDomain.CreateInstance(String assemblyName, String typeName) If I place Apache.Web.dll in both <APACHE_PATH>\bin, and in a configured application's /bin, the application works. So at this point I have a workable, though less than ideal, solution. I'm now going to do some digging into the first error. I have found some information that suggests calls to System.Web.Hosting.ApplicationHost.CreateApplicationHost require the type passed be registered in the GAC. Now I'm just trying to understand why. Once again what I'm trying to do is get ASP.Net working in XAMPP on a USB drive. Assuming, of course, that a supporting .Net framework is installed on the PC I'm plugged into I'll have a portable asp.net web server. -----Original Message----- From: Electronjockey <ele...@ho...> To : mod...@li... Sent: Sun Feb 21 14:19:15 2010 Subject: Re: GAC Alternative I'm back to my "mobilizing" mod_aspdotnet project and came across this note in the README: And Apache.Web.dll must be in the Global Assembly Cache to participate in the system.web framework. Is there any way around this? Any thoughts? ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Mod-aspdotnet-users mailing list Mod...@li... https://lists.sourceforge.net/lists/listinfo/mod-aspdotnet-users ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Mod-aspdotnet-users mailing list Mod...@li... https://lists.sourceforge.net/lists/listinfo/mod-aspdotnet-users ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Mod-aspdotnet-users mailing list Mod...@li... https://lists.sourceforge.net/lists/listinfo/mod-aspdotnet-users |