2010-03-04 65 views
0

我試圖開發分派(分派器)到另一個Web應用程序的多個版本在每個請求的Web應用程序。爲了實現這一目的,我使用ApplicationManager.CreateObject創建運行有問題的Web應用程序的新應用程序域,但新的應用程序域似乎無法加載分派器的DLL(我在複製DLL到Web應用程序的bin目錄,所以我很確定它在那裏)。ApplicationManager.CreateObject未能在新的AppDomain中加載程序集

var version = "version"; 
var path = @"C:\code\devel\webapp"; 

// Copy host assembly to target webapp so that 'Host' is available 
var assembly = Assembly.GetExecutingAssembly().Location; 
var target = path + "\\bin\\" + Path.GetFileName(assembly); 
File.Copy(assembly, target, true); 

var manager = ApplicationManager.GetApplicationManager(); 
var obj = manager.CreateObject(version, typeof(Host), "/", path, true, true); 

這裏的融合日誌:

Assembly manager loaded from: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll 
Running under executable C:\Program Files (x86)\Common Files\Microsoft Shared\DevServer\9.0\WebDev.WebServer.exe 
--- A detailed error log follows. 

=== Pre-bind state information === 
LOG: User = FOOBAR\aaron 
LOG: DisplayName = Dispatcher, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 
(Fully-specified) 
LOG: Appbase = file:///C:/Program Files (x86)/Common Files/Microsoft Shared/DevServer/9.0/ 
LOG: Initial PrivatePath = NULL 
Calling assembly : (Unknown). 
=== 
LOG: This bind starts in default load context. 
LOG: No application configuration file found. 
LOG: Using machine configuration file from c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config. 
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind). 
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Common Files/Microsoft Shared/DevServer/9.0/Dispatcher.DLL. 
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Common Files/Microsoft Shared/DevServer/9.0/Dispatcher/Dispatcher.DLL. 
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Common Files/Microsoft Shared/DevServer/9.0/Dispatcher.EXE. 
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Common Files/Microsoft Shared/DevServer/9.0/Dispatcher/Dispatcher.EXE. 

的應用平臺,似乎在開發服務器的根被人指指點點,而不是路徑中ApplicationManager.CreateObject過去了,它只是似乎是搜索在開發服務器下的目錄看起來很奇怪。就如何使在web應用程序的根,而不是在開發服務器DLL中的新的AppDomain搜索任何想法?

回答

2

它看起來像(至少在我們的情況),這是錯誤的路要走:使用反向代理是正確的方式。

反向代理的優勢在於他們是在HTTP架構的「模式」,他們拯救我們不必確保ASP.NET運行時是真的在應用程序域配置正確運行的實際網絡應用。

目前,我們正在尋找ProxyMachine這是GitHub seems to have had some success with一個高度可配置的TCP反向代理。

相關問題