添加对 .dll asp.net 的引用

发布于 2024-10-08 07:18:31 字数 906 浏览 2 评论 0原文

我有一个关于添加对 .NET 项目的引用的简单问题。我正在将 reCAPTCHA 添加到网站,并且我已经下载了 dll。

设置对 dll 的引用后,我构建并运行项目并收到此错误:

[ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.]
   System.Reflection.Module._GetTypesInternal(StackCrawlMark& stackMark) +0
   System.Reflection.Assembly.GetTypes() +96
   StarSuite.Core.Settings.GetSingletonInstancesOfBaseType(Type baseType, String staticMethodName, Type returnType) +149

[ApplicationException: Unable to load types from 'Recaptcha, Version=1.0.5.0, Culture=neutral, PublicKeyToken=9afc4d65b28c38c2'. LoaderExceptions: [FileNotFoundException: Could not load file or assembly 'System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.]
]

我缺少什么,为什么会收到此错误?

I have a simple question about adding references to a .NET project. I'm adding reCAPTCHA to a website and i have downloaded the dll.

After setting the reference to the dll i build and run the project and gets this error:

[ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.]
   System.Reflection.Module._GetTypesInternal(StackCrawlMark& stackMark) +0
   System.Reflection.Assembly.GetTypes() +96
   StarSuite.Core.Settings.GetSingletonInstancesOfBaseType(Type baseType, String staticMethodName, Type returnType) +149

[ApplicationException: Unable to load types from 'Recaptcha, Version=1.0.5.0, Culture=neutral, PublicKeyToken=9afc4d65b28c38c2'. LoaderExceptions: [FileNotFoundException: Could not load file or assembly 'System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.]
]

What am i missing, why do i get this error?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

诗酒趁年少 2024-10-15 07:18:31

抱歉,如果这个问题很愚蠢……这是您的 Web 项目 MVC 吗?看来,如果您使用基于 Web 表单的项目,则不应使用该组件,因为它依赖于 mvc 程序集(也许有 Web 表单版本?)。

Sorry if the question is silly...Is it your web project MVC? It seems that If you're using web form based project you shouldn't use that component since it relies on mvc assemblies (maybe there is a web form version?).

大姐,你呐 2024-10-15 07:18:31

找不到文件

这就是你的原因 - 它在输出中:

FileNotFoundException

仔细检查你的引用指向的位置

File Not Found:

This is you reason - its in the output:

FileNotFoundException

Double check where your reference is pointing to

月下伊人醉 2024-10-15 07:18:31

您是否已在项目的引用下添加了 DLL,以便将其包含在构建中?

Have you added the DLL under references in your project so it will be included in the build?

椒妓 2024-10-15 07:18:31

对于在寻找 Umbraco 修复程序时发现此问题的人,可以在此处找到修复程序:

http://our.umbraco.org/forum/developers/xslt/19383-referencing-catcha-dll-breaks-xslt

相同的修复可以应用于不支持的网站运行乌布拉科。

摘要为了让您不必阅读整个论坛帖子,请将其添加到您的网络配置中:

<runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
            <dependentAssembly>
                <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
                <bindingRedirect oldVersion="1.0.0.0"
          newVersion="2.0.0.0"/>
            </dependentAssembly>
        </assemblyBinding>
    </runtime>

For people finding this whilst searching for a fix for Umbraco, the fix can be found here:

http://our.umbraco.org/forum/developers/xslt/19383-referencing-catcha-dll-breaks-xslt

The same fix can be applied to websites that are not running Umbraco.

Summary to save you having to read the whole forum post, add this to your web config:

<runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
            <dependentAssembly>
                <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
                <bindingRedirect oldVersion="1.0.0.0"
          newVersion="2.0.0.0"/>
            </dependentAssembly>
        </assemblyBinding>
    </runtime>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文