2013-02-02 5 views
0

가능한 중복은 :
Why can’t it find my BasicAuthenticationModule?왜 내 모듈을 찾지 못합니까?

나는 기본 인증의 내 자신의 구현을 만들려고 해요. 나는 BasicAuthenticationModule.cssolution\Modules 및 네임 스페이스에 저장 한

은 다음과 같습니다

namespace Web_API.Modules 
{ 
    public class BasicAuthenticationModule : IHttpModule 

필자와 같은 제의 Web.config에 추가 :

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

내가 이것을 실행 다음과 같은 오류가 발생합니다 :

Server Error in '/' Application. 

Could not load file or assembly 'BasicAuthenticationModule' or one of its dependencies. The system cannot find the file specified. 

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.IO.FileNotFoundException: Could not load file or assembly 'BasicAuthenticationModule' or one of its dependencies. The system cannot find the file specified. 

여기서 내가 뭘 잘못하고 있니?

+1

가 어떻게 조립 예를 들어

하여 ASP.NET MVC 응용 프로그램이 정의는 다음과 같을 수 MvcAPplication1 불려 갔을 경우 귀하의 클래스를 보유하고 디스크에 명명 된? – rene

+0

@rene 지정해 주시겠습니까? – Jason94

+1

클래스를 보유하고있는 프로젝트는 dll에서 컴파일 된대로 출력 파일 이름을가집니다. 나는 dll의 이름이 BasicAuthenticationModule이 아니라 아마도 Web_API 또는 그와 비슷한 것으로 의심한다. – rene

답변

3

모듈에 잘못된 어셈블리 이름이 지정되어있는 것 같습니다. 당신이 쓸 때 :

type="Web_API.Modules.BasicAuthenticationModule, BasicAuthenticationModule" 

BasicAuthenticationModule라는 어셈블리 내에서 Web_API.Modules 네임 스페이스 내에서 BasicAuthenticationModule라는 클래스를로드하는 것을 의미합니다. 이 클래스를 정의한 프로젝트가 BasicAuthenticationModule입니까? 나는 그렇지 않다. 그래서 ASP.NET이 모듈을로드 할 수 없습니다. 이 모듈이 정의 된 올바른 어셈블리 이름을 지정해야합니다.

type="Web_API.Modules.BasicAuthenticationModule, MvcApplication1" 

type 속성의 형식은 다음과 같이이다 :

type="Namespace.ClassName, AssemblyName" 
+0

지금 메신저 '값은 null 일 수 없습니다. 매개 변수 이름 : typeName '내 모듈에 다음 :'string provider = ConfigurationManager.AppSettings [ "Web_API.Modules.BasicAuthenticationModule.AuthProvider"]; 형식 providerType = Type.GetType (공급자, true); ' provider가 null 인 경우, 어딘가에 정의해야합니까? – Jason94

+0

글쎄, 당신은 몇 가지 런타임 유형을 가리키는 web.config 파일에 'Web_API.Modules.BasicAuthenticationModule.Auth Provider' 설정을 정의한 것 같습니다. 또한 "Namespace.ClassName, AssemblyName"패턴을 따르고이 유형이 실제로 존재하는지 확인하십시오. 말하기는 어렵지만 최소한 현재 모듈이로드되어 실행되었습니다.이 모듈은 원래의 질문이었습니다. –

+0

나는 야생 추측을했고 작동했다 ... – Jason94

관련 문제