2011-02-25 2 views
1

iis7에 가상 디렉터리로 여러 openrasta 응용 프로그램을 호스팅하는 사이트가 있습니다. 이 openrasta 응용 프로그램 중 하나는 단일 리소스를 호스팅하므로 가상 디렉터리의 루트에서 실행되도록합니다. 리소스를 성공적으로 가져올 수 있지만 리소스를 POST 할 수 없습니다. 게시 할 때 405 오류가 발생합니다. 내가 다른 응용 프로그램을 추가 할자료실에 공개 자료실에 게시하기

 
http://localhost/OpenRastaApp1/Resource1 
http://localhost/OpenRastaApp1/Resource2 
http://localhost/OpenRastaApp2/Resource3 
http://localhost/OpenRastaApp2/Resource4 

하지만,이 응용 프로그램은 1 자원이 포함됩니다 나는 앱의 기본 URI를 통해 액세스 할 : 같은

는 로컬 같습니다. 나는.

 
http://localhost/OpenRastaApp3 not http://localhost/OpenRastaApp3/Resource5 

리소스 5를 얻을 수 있지만 아래 구성을 사용하여 POST 할 수 없습니다.

게시 할 때 ID를 포함하지 않으므로 "/ {id}"템플릿과 일치하지 않아야합니다.

ResourceSpace.Has 
    .ResourcesOfType<ThingResource>() 
    .AtUri("/").And 
    .AtUri("/{id}") 
    .HandledBy<ThingHandler>() 
    .AsJsonDataContract(); 

을 그리고 내 처리기 코드는 다음과 같습니다 :

public class ThingHandler 
{ 
    [HttpOperation(HttpMethod.POST)] 
    public OperationResult Post(ThingResource thingResource) 
    { 
     var thing = thingResource.ToThingEntity(); 
     thing = _thingService.Make(thing); 
     return new OperationResult.OK(thing.ToThingResource()); 
    } 

    [HttpOperation(HttpMethod.GET)] 
    public OperationResult Get(int id) 
    { 
     var thing = _thingService.Get(id); 
     return new OperationResult.OK(thing.ToThingResource()); 
    } 
} 

디버그 로그 거기서이 나를 도울 수

 
13-[2011-03-01 10:38:59Z] Verbose(0) Incoming host request for http://api.local.site.com/Thing 
13-[2011-03-01 10:38:59Z] Verbose(0) Adding communication context data 
13-[2011-03-01 10:38:59Z] Warning(0) Contributor call for BootstrapperContributor had a null Action. 
13-[2011-03-01 10:38:59Z] Start(1) Entering PipelineRunner: Executing contributor ExceptionHandlerContributor.LogException 
13-[2011-03-01 10:38:59Z] Stop(1) Exiting PipelineRunner 
13-[2011-03-01 10:38:59Z] Start(1) Entering PipelineRunner: Executing contributor HttpMethodOverriderContributor.OverrideHttpVerb 
13-[2011-03-01 10:38:59Z] Stop(1) Exiting PipelineRunner 
13-[2011-03-01 10:38:59Z] Start(1) Entering PipelineRunner: Executing contributor DigestAuthorizerContributor.ReadCredentials 
13-[2011-03-01 10:38:59Z] Stop(1) Exiting PipelineRunner 
13-[2011-03-01 10:38:59Z] Start(1) Entering PipelineRunner: Executing contributor UriDecoratorsContributor.ProcessDecorators 
13-[2011-03-01 10:38:59Z] Stop(1) Exiting PipelineRunner 
13-[2011-03-01 10:38:59Z] Start(1) Entering PipelineRunner: Executing contributor ResourceTypeResolverContributor.ResolveResource 
13-[2011-03-01 10:38:59Z] Stop(1) Exiting PipelineRunner 
13-[2011-03-01 10:38:59Z] Start(1) Entering PipelineRunner: Executing contributor HandlerResolverContributor.ResolveHandler 
13-[2011-03-01 10:38:59Z] Stop(1) Exiting PipelineRunner 
13-[2011-03-01 10:38:59Z] Start(1) Entering PipelineRunner: Executing contributor OperationCreatorContributor.CreateOperations 
    13-[2011-03-01 10:38:59Z] Verbose(0) Created operation named Post with signature ThingHandler::Post(ThingResource ThingResource) 
    13-[2011-03-01 10:38:59Z] Verbose(0) Created operation named Get with signature ThingHandler::Get(Int32 id) 
    13-[2011-03-01 10:38:59Z] Verbose(0) Created operation named Amend with signature ThingHandler::Amend(ThingResource ThingResource) 
    13-[2011-03-01 10:38:59Z] Verbose(0) Created operation named Cancel with signature ThingHandler::Cancel(Int32 id) 
13-[2011-03-01 10:38:59Z] Stop(1) Exiting PipelineRunner 
13-[2011-03-01 10:38:59Z] Start(1) Entering PipelineRunner: Executing contributor OperationFilterContributor.ProcessOperations 
    13-[2011-03-01 10:38:59Z] Verbose(0) Found 1 operation(s) with a matching name. 
    13-[2011-03-01 10:38:59Z] Verbose(0) Found 1 operation(s) with matching [HttpOperation] attribute. 
    13-[2011-03-01 10:38:59Z] Verbose(0) No resource or no uri name. Not filtering. 
A first chance exception of type 'System.FormatException' occurred in mscorlib.dll 
A first chance exception of type 'System.FormatException' occurred in mscorlib.dll 
A first chance exception of type 'System.Exception' occurred in System.dll 
A first chance exception of type 'System.NotSupportedException' occurred in OpenRasta.DLL 
A first chance exception of type 'System.FormatException' occurred in mscorlib.dll 
A first chance exception of type 'System.FormatException' occurred in mscorlib.dll 
A first chance exception of type 'System.Exception' occurred in System.dll 
A first chance exception of type 'System.NotSupportedException' occurred in OpenRasta.DLL 
    13-[2011-03-01 10:38:59Z] Error(0) None of the operations had members that could be matches against the uri parameters: 
id=Thing; 

13-[2011-03-01 10:38:59Z] Stop(1) Exiting PipelineRunner 
13-[2011-03-01 10:38:59Z] Verbose(0) Pipeline is in RenderNow mode. 
13-[2011-03-01 10:38:59Z] Start(1) Entering PipelineRunner: Executing contributor OperationResultInvokerContributor.RunOperationResult 
    13-[2011-03-01 10:38:59Z] Information(0) Executing OperationResult OperationResult: type=MethodNotAllowed, statusCode=405. 
13-[2011-03-01 10:38:59Z] Stop(1) Exiting PipelineRunner 
13-[2011-03-01 10:38:59Z] Start(1) Entering PipelineRunner: Executing contributor ResponseEntityCodecResolverContributor.FindResponseCodec 
    13-[2011-03-01 10:38:59Z] Information(0) No response codec was searched for. The response entity is null or a response codec is already set. 
13-[2011-03-01 10:38:59Z] Stop(1) Exiting PipelineRunner 
13-[2011-03-01 10:38:59Z] Start(1) Entering PipelineRunner: Executing contributor DigestAuthorizerContributor.WriteCredentialRequest 
13-[2011-03-01 10:38:59Z] Stop(1) Exiting PipelineRunner 
13-[2011-03-01 10:38:59Z] Start(1) Entering PipelineRunner: Executing contributor ResponseEntityWriterContributor.WriteResponse 
    13-[2011-03-01 10:38:59Z] Verbose(0) There was no response entity, not rendering. 
    13-[2011-03-01 10:38:59Z] Verbose(0) Writing http headers. 
13-[2011-03-01 10:38:59Z] Stop(1) Exiting PipelineRunner 
13-[2011-03-01 10:38:59Z] Information(0) Pipeline finished. 

사람을 다음과 같이 다음과 같이

내 구성은 ?

건배

데이브

+0

게시 할 때 실제로 일어나는 일을 알려주는 디버그 로그를 추가 할 수 있다면. – SerialSeb

답변

0

로그없이, 나는 단지 하나의 간단한 잠재적 인 답을 것입니다. IIS에서 정의한 다른 모듈을 확인하고 /를 POST 할 수있는 모듈을 제거 (또는 재정렬)하십시오 (예 : 기본 문서). 이 모듈들 중 상당수는 탐욕스럽게 자신들이 요청을 소유하고 있다고 가정하여 호환 지옥을 일으 킵니다.

+0

OpenRastaModule이 먼저 나오고 여전히 작동하지 않도록 모듈을 재정렬했습니다. 어떤 기록을보아야합니까? – DChater

+0

디버거 (또는 DebugView)를 iis 작업자 프로세스에 연결하고 uri에 대한 요청을하면 로그가 제공됩니다. 어제 저녁에이 문제에 대해 들었습니다. 정말 관심이 있습니다. 서버에 정의 된 모듈 (기본 문서)은 기본적으로 앱의 모듈보다 먼저 실행됩니다. – SerialSeb

+0

지연되는 일은 유감스럽게 생각합니다. 나는 원래 질문을 디버거의 출력으로 수정했다. 서버 모듈을 검사했지만 뭔가 빠졌을 수 있습니다. 지금 다시 확인해 보겠습니다. – DChater

0

다른 답변을 문제로 게시하는 것은 다릅니다.

로그에// id라는 템플릿과 일치하는 내용이 있습니다. 그런 다음이 템플리트는 메소드에 int 유형의 ID로 맵핑됩니다. 문제는 int로 변환 할 수 없으므로 실패합니다.

응용 프로그램이/Thing의 가상 디렉터리에 있다고 말하는 것입니까? 이 경우 가상 디렉터리를 응용 프로그램으로 표시하거나 URI를/Thing/{id} 및/Thing /로 매핑해야합니다.

+0

원래 설정을 더 자세하게 수정했습니다. 이게 더 명확 해 졌나요? 다시 한번 감사드립니다. – DChater

+0

글쎄, 정말로.로그에는 다음과 같은 내용이 있습니다. 작업 중 uri 매개 변수와 일치 할 수있는 멤버가없는 작업 id = Thing; 즉, OpenRasta는 사용자가 게시 한 URI를 봅니다. (분명히 이전의 디버그 로그에 있었지만 더 이상 존재하지 않는데, 디버그 로그에서도 계속 볼 수 있기 때문에 로그를 수동으로 편집했다고 가정합니다.) uri 템플릿에 대해 리소스를 찾습니다 (/ POST에/Thing하고 있기 때문에 일명/{id}). IIS에서 가상 디렉터리 *가 응용 프로그램인지 * 확인 했습니까? 이유에 대해서는 위의 내 의견을 참조하십시오. – SerialSeb