【发布时间】:2018-09-25 11:08:48
【问题描述】:
我的应用程序有一个 dll,它将由驻留在全局程序集缓存中的 .NET 框架程序集调用。这在本地机器上完美运行。
我在 Azure Web 应用程序中遇到问题。在 Azure Web 应用程序中,我无法将我的程序集添加到 GAC。因此,每当 GAC dlls(System.dll,System.Xml.dll,..etc) 尝试加载我的程序集时,它都会通过抛出文件未找到异常而失败。但在同一个过程中,我的程序集被加载到不同的应用程序域 /LM/2/... 而不是 AppDomain “EE Shared Assembly Repository”中。
var appDomain = AppDomain.CreateDomain("New AppDomain", null, new AppDomainSetup
{
CachePath = AppDomain.CurrentDomain.SetupInformation.CachePath,
ShadowCopyFiles = "true",
LoaderOptimization = LoaderOptimization.SingleDomain //tried MultiDomain too
});
通过上面的一些代码,我尝试创建一个具有不同配置和加载器优化集的 AppDomain 并将程序集加载到其中,以便 System.dll 可以找到并加载我的程序集。但这也很有效。
如何让我的程序集(存在于 %home%\wwwroot\bin 中)加载到存在于 GAC 中的 dll 中..?
【问题讨论】:
标签: c# .net azure azure-web-app-service .net-assembly