【问题标题】:Specifying the location of an assembly to II将装配的位置指定为 II
【发布时间】:2010-01-07 16:02:01
【问题描述】:

我的 ASP.NET 应用程序使用了一些第三程序集。使应用程序加载该程序集的选项是什么?我必须把它放在 GAC 中吗? 我不想修改机器的 PATH 环境变量...

【问题讨论】:

    标签: iis assemblies


    【解决方案1】:

    您可以将它放入您的应用程序文件夹(最佳解决方案)或在您的网络配置中添加一个代码库标签,如this msdn entry 中所述:

    <configuration>
     <runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
         <dependentAssembly>
            <assemblyIdentity name="MyAssembly2"  culture="neutral" publicKeyToken="307041694a995978"/>
            <codeBase version="1.0.1524.23149" href="FILE://C:/Myassemblies/MyAssembly2.dll"/>
         </dependentAssembly>
      </assemblyBinding>
     </runtime>
    </configuration>
    

    仅当您想要共享该程序集时才将其添加到 GAC。

    【讨论】:

      【解决方案2】:

      你的程序集是强命名的吗?

      您可以将它放在 GAC 中,也可以在 web.config 中引用它(根据 MSDN article. 使用 &lt;codeBase&gt; 元素

      如果没有

      程序集必须位于 Web 应用程序的 bin 文件夹中。

      【讨论】:

        猜你喜欢
        • 2011-12-11
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-11-21
        • 2012-05-08
        • 2014-03-07
        • 1970-01-01
        • 2017-11-22
        相关资源
        最近更新 更多