oracle 在 web.config 中设置要加载的 DLL 的位置

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7040432/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 00:13:58  来源:igfitidea点击:

Set location of DLLs to load in web.config

asp.netoracleweb-configgac

提问by tgandrews

Is it possible within the web.config to set the local file path location of specific DLLs to load rather than having those DLL in the GAC or C:\Windows\System32.

是否可以在 web.config 中设置要加载的特定 DLL 的本地文件路径位置,而不是将这些 DLL 放在 GAC 或C:\Windows\System32.

This would make it much easier to deploy the web service, without having to mess around with either of those.

这将使部署 Web 服务变得更加容易,而不必弄乱其中任何一个。

I have tried already to add the DLLs to the project but with out success. They are the 4 oracle instant client DLLs.

我已经尝试将 DLL 添加到项目中,但没有成功。它们是 4 个 oracle 即时客户端 DLL。

  • oci.dll
  • orannzsbb11.dll
  • oraocci11.dll
  • oraociicus11.dll
  • oci.dll
  • orannzsbb11.dll
  • oraocci11.dll
  • oraociicus11.dll

If anyone knows of a way of doing this that would be great.

如果有人知道这样做的方法,那就太好了。

EDIT: Please note, note of the DLLs are "strongly named" so I cannot reference them using their public key.

编辑:请注意,DLL 是“强命名”的,所以我不能使用它们的公钥来引用它们。

Also, they are not referenced directly in the project currently because they fail to add.

此外,它们目前在项目中没有直接引用,因为它们无法添加。

回答by Oded

You can use the dependentAssemblyelement to specify where a dlllives through the codeBaseelement.

您可以使用dependentAssembly元素来指​​定dll通过codeBase元素生活的位置。

However, I believe this needs to be a valid URL.

但是,我认为这需要是一个有效的 URL。

Example from MSDN:

来自MSDN 的示例:

<configuration>
   <runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
         <dependentAssembly>
            <assemblyIdentity name="myAssembly"
                              publicKeyToken="32ab4ba45e0a69a1"
                              culture="neutral" />
            <bindingRedirect oldVersion="1.0.0.0"
                             newVersion="2.0.0.0"/>
            <codeBase version="2.0.0.0"
                      href="http://www.litwareinc.com/myAssembly.dll"/>
         </dependentAssembly>
      </assemblyBinding>
   </runtime>
</configuration>

回答by Simon Halsey

Probing paths let you specify where an application should look for assemblies. This won't affect putting things in the GAC, but gives you an alternative to storing everything in the bin folder.

探测路径让您可以指定应用程序应在何处查找程序集。这不会影响将内容放入 GAC,但为您提供了将所有内容存储在 bin 文件夹中的替代方法。

http://msdn.microsoft.com/en-us/library/823z9h8w.aspx

http://msdn.microsoft.com/en-us/library/823z9h8w.aspx