【发布时间】:2013-02-02 22:11:33
【问题描述】:
我正在尝试创建自己的基本身份验证实现。
我有BasicAuthenticationModule.cs 存储在我的solution\Modules 中,它的命名空间是:
namespace Web_API.Modules
{
public class BasicAuthenticationModule2 : IHttpModule
我已将其添加到我的 web.config 中:
<system.webServer>
<modules>
<add name="BasicAuthenticationModule" type="Web_API.Modules.BasicAuthenticationModule, BasicAuthenticationModule"/>
运行这让我:HTTP Error 500.19 - Internal Server Error - Cannot add duplicate collection entry of type 'add' with unique key attribute 'name' set to 'BasicAuthenticationModule'
有人知道吗?
【问题讨论】:
-
BasicAuthenticationModule2 ?
-
我现在得到'无法加载文件或程序集'BasicAuthenticationModule'或其依赖项之一。系统找不到指定的文件。'
-
类型不是
Web_API.Modules.BasicAuthenticationModule2吗? -
看起来很垃圾,但我将我的课程重命名为“BasicAuthenticationModule2”。我的 'system.WebServer' 'modules' 现在看起来像:'
' 我仍然得到:'Could not load file or assembly 'BasicAuthenticationModule2' or它的依赖项之一。系统找不到指定的文件。' -
试试
<add name="BasicAuthenticationModule2" type=" Web_API.Modules.BasicAuthenticationModule2"/>
标签: c# asp.net asp.net-mvc-4 basic-authentication