c# - 防止在 IIS 中加载特定的 dll

标签 c# c++ iis-7

我遇到了以下常见错误:

Could not load file or assembly '...' or one of its dependencies. The specified module could not be found.

问题是此 dll 引用了非托管 dll,因此它永远无法正确加载。我只想让 IIS 忽略这个文件。

我正在玩弄 <remove assembly>标记在 web.config 中,但没有运气。

关于如何防止加载我的一个 dll 有什么建议吗?

最佳答案

虽然我找不到限制特定程序集的方法,但我能够通过删除所有程序集并添加我需要的特定程序集来完成它。将 web.config 文件更改为:

<system.web>
    <compilation targetFramework="4.0">
        <assemblies>
            <remove assembly="*"/>
            <add assembly="example.dll"/>
        </assemblies>
    </compilation>
</system.web>

关于c# - 防止在 IIS 中加载特定的 dll,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11958676/

相关文章:

c# - VB 6.0 中的 String(33, 0) 和 C# 中的等效项

c# - 查找匹配字符串算法

c++ - "Iterator not dereferenceable"

iis-7 - IIS7 urlrewrite 模块 - 外部 xml 文件中的规则

c# - Autofac IComponentContext.Resolve<Type> 是服务定位器模式吗

c# - ComboBox TwoWay 绑定(bind)不起作用

C++,无法从so库访问包含的头文件

c++ - 将 Linux system() 调用命令的输出重定向到一个变量

c# - 如何调试崩溃的转储文件?

iis - 简单 IIS 重定向表达式 ("*") 引发错误 : The expression "*" contains a repeat expression