2013-02-02 61 views
1

我正在嘗試創建自己的基本身份驗證實現。爲什麼找不到我的BasicAuthenticationModule?

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'

有沒有人有線索?

+0

BasicAuthenticationModule2? – MikeSmithDev

+0

我現在得到'無法加載文件或程序集'BasicAuthenticationModule'或它的一個依賴項。該系統找不到指定的文件。' – Jason94

+0

類型不是'Web_API.Modules.BasicAuthenticationModule2'嗎? – MikeSmithDev

回答

0

原因是因爲內部已經有一個名爲BasicAuthorizationModule的內置模塊。

你將需要:

  • 使用不同Name(例如BasicAuthModule
  • 刪除現有BasicAuthorizationModeule模塊入口