为什么找不到我的BasicAuthenticationModule? [英] Why can't it find my BasicAuthenticationModule?

查看:67
本文介绍了为什么找不到我的BasicAuthenticationModule?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建自己的基本身份验证实现.

I'm trying to create my own implementation of a basic-authentication.

我在我的 solution \ Modules 中存储了 BasicAuthenticationModule.cs ,其命名空间为:

I have BasicAuthenticationModule.cs stored in my solution\Modules and its namespace is:

namespace Web_API.Modules
{
public class BasicAuthenticationModule2 : IHttpModule

我已经将其添加到我的web.config中,

Ive added it to my web.config as such:

<system.webServer>
    <modules>
      <add name="BasicAuthenticationModule" type="Web_API.Modules.BasicAuthenticationModule, BasicAuthenticationModule"/>

运行此命令得到我: HTTP错误500.19-内部服务器错误-无法添加类型为'add'的重复收集条目,且唯一键属性'name'设置为'BasicAuthenticationModule'

有人知道吗?

推荐答案

原因是因为.NET内已有一个名为 BasicAuthorizationModule 的内置模块.

The reason is because there already is a built-in module called BasicAuthorizationModule that comes inside .NET.

您将需要:

  • 使用其他 Name (例如 BasicAuthModule )
  • 删除现有的 BasicAuthorizationModeule 模块条目
  • use a different Name (e.g. BasicAuthModule)
  • remove the existing BasicAuthorizationModeule module entry

这篇关于为什么找不到我的BasicAuthenticationModule?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆