如何在 OpenRasta 中使用 /prefix/{suffix} 形式的 URI 模板处理多部分 POST?
我正在尝试使用 /content/{contentId} 的 URI 模板声明来处理 OpenRasta 中的多部分文档的 POST,但它失败了。配置是
ResourceSpace.Has.ResourcesOfType<Content>().AtUri("/content/{contentId}").HandledBy<ContentHandler>().RenderedByAspx("~/Views/ContentView.aspx").And.AsJsonDataContract();
处理程序方法如下:
public OperationResult Post(string contentId, IEnumerable<IMultipartHttpEntity> entities) {...}
我正在使用以下curl 命令来测试
./curl -v -F myPartName=@./hello.txt http://localhost:10247/content/id-1
如果我从 URI 模板中删除“{contentId}”并相应地修改处理程序,则 POST 工作正常。
关于如何解决的任何想法?日志文件如下。谢谢--罗兰
4-[2011-10-10 02:27:47Z] Verbose(0) Starts pre-executing the request.
4-[2011-10-10 02:27:47Z] Verbose(0) Incoming host request for http://localhost:10247/content/id-1
4-[2011-10-10 02:27:47Z] Verbose(0) Adding communication context data
4-[2011-10-10 02:27:47Z] Warning(0) Contributor call for BootstrapperContributor had a null Action.
4-[2011-10-10 02:27:47Z] Start(1) Entering PipelineRunner: Executing contributor HttpMethodOverriderContributor.OverrideHttpVerb
4-[2011-10-10 02:27:47Z] Stop(1) Exiting PipelineRunner
4-[2011-10-10 02:27:47Z] Start(1) Entering PipelineRunner: Executing contributor AuthenticationContributor.AuthoriseRequest
4-[2011-10-10 02:27:47Z] Stop(1) Exiting PipelineRunner
4-[2011-10-10 02:27:47Z] Start(1) Entering PipelineRunner: Executing contributor UriDecoratorsContributor.ProcessDecorators
4-[2011-10-10 02:27:47Z] Stop(1) Exiting PipelineRunner
4-[2011-10-10 02:27:47Z] Start(1) Entering PipelineRunner: Executing contributor ResourceTypeResolverContributor.ResolveResource
4-[2011-10-10 02:27:51Z] Stop(1) Exiting PipelineRunner
4-[2011-10-10 02:27:51Z] Verbose(0) Rewrote path.
4-[2011-10-10 02:27:51Z] Start(1) Entering OpenRastaRewriterHandler: Rewriting to original path
4-[2011-10-10 02:27:51Z] Start(1) Entering OpenRastaIntegratedHandler: Request for http://localhost:10247/content/id-1
4-[2011-10-10 02:27:51Z] Verbose(0) Incoming host request for http://localhost:10247/content/id-1
4-[2011-10-10 02:27:51Z] Verbose(0) Adding communication context data
4-[2011-10-10 02:27:51Z] Start(1) Entering PipelineRunner: Executing contributor HandlerResolverContributor.ResolveHandler
4-[2011-10-10 02:27:51Z] Stop(1) Exiting PipelineRunner
4-[2011-10-10 02:27:51Z] Start(1) Entering PipelineRunner: Executing contributor OperationCreatorContributor.CreateOperations
4-[2011-10-10 02:27:51Z] Verbose(0) Created operation named Get with signature ContentHandler::Get(String contentId)
4-[2011-10-10 02:27:51Z] Verbose(0) Created operation named Post with signature ContentHandler::Post(String contentId, IEnumerable`1 entities)
4-[2011-10-10 02:27:51Z] Stop(1) Exiting PipelineRunner
4-[2011-10-10 02:27:51Z] Start(1) Entering PipelineRunner: Executing contributor OperationFilterContributor.ProcessOperations
4-[2011-10-10 02:27:51Z] Verbose(0) Found 1 operation(s) with a matching name.
4-[2011-10-10 02:27:51Z] Verbose(0) Found 0 operation(s) with matching [HttpOperation] attribute.
4-[2011-10-10 02:27:51Z] Verbose(0) No resource or no uri name. Not filtering.
4-[2011-10-10 02:27:51Z] Stop(1) Exiting PipelineRunner
4-[2011-10-10 02:27:51Z] Start(1) Entering PipelineRunner: Executing contributor OperationCodecSelectorContributor.ProcessOperations
4-[2011-10-10 02:27:51Z] Information(0) Operation ContentHandler::Post(String contentId, IEnumerable`1 entities) selected with 2 required members and 0 optional members, with codec MultipartFormDataKeyedValuesCodec with score 1.5.
4-[2011-10-10 02:27:51Z] Stop(1) Exiting PipelineRunner
4-[2011-10-10 02:27:51Z] Start(1) Entering PipelineRunner: Executing contributor OperationHydratorContributor.ProcessOperations
4-[2011-10-10 02:27:51Z] Information(0) Operation ContentHandler::Post(String contentId, IEnumerable`1 entities) was selected with a codec score of 1.5
4-[2011-10-10 02:27:51Z] Information(0) Loaded codec OpenRasta.Codecs.MultipartFormDataKeyedValuesCodec
4-[2011-10-10 02:27:51Z] Information(0) Codec supports IKeyedValuesMediaTypeReader. Processing parameters.
4-[2011-10-10 02:27:51Z] Verbose(0) Seeking to next available part
4-[2011-10-10 02:27:51Z] Verbose(0) Skip the preamble. AtPreamble was True.
4-[2011-10-10 02:27:51Z] Verbose(0) not null
4-[2011-10-10 02:27:51Z] Verbose(0) Preamble found: True of size 0
4-[2011-10-10 02:27:51Z] Verbose(0) not null
4-[2011-10-10 02:27:51Z] Verbose(0) not null
4-[2011-10-10 02:27:51Z] Verbose(0) not null
4-[2011-10-10 02:27:51Z] Verbose(0) Skip the preamble. AtPreamble was False.
4-[2011-10-10 02:27:51Z] Verbose(0) Preamble found: False of size 0
4-[2011-10-10 02:27:51Z] Verbose(0) not null
4-[2011-10-10 02:27:51Z] Verbose(0) not null
4-[2011-10-10 02:27:51Z] Verbose(0) Seeking to next available part
4-[2011-10-10 02:27:51Z] Verbose(0) not null
4-[2011-10-10 02:27:51Z] Verbose(0) not null
4-[2011-10-10 02:27:51Z] Verbose(0) Key myPartName was not successfully assigned.
4-[2011-10-10 02:27:51Z] Verbose(0) Key myPartName was not successfully assigned.
4-[2011-10-10 02:27:51Z] Stop(1) Exiting PipelineRunner
4-[2011-10-10 02:27:51Z] Start(1) Entering PipelineRunner: Executing contributor OperationInterceptorContributor.WrapOperations
4-[2011-10-10 02:27:51Z] Stop(1) Exiting PipelineRunner
4-[2011-10-10 02:27:51Z] Start(1) Entering PipelineRunner: Executing contributor OperationInvokerContributor.ExecuteOperations
4-[2011-10-10 02:27:51Z] Verbose(0) Ignoring constructor, following dependencies didn't have a registration:OpenRasta.OperationModel.Interceptors.IOperationInterceptor[]
A first chance exception of type 'System.InvalidOperationException' occurred in OpenRasta.DLL
4-[2011-10-10 02:27:52Z] Error(0) An error of type System.InvalidOperationException has been thrown
4-[2011-10-10 02:27:52Z] Error(0) System.InvalidOperationException: The operation is not ready for invocation.
4-[2011-10-10 02:27:52Z] Error(0) at OpenRasta.OperationModel.MethodBased.MethodBasedOperation.Invoke() in C:\Users\hochmuth\Repositories\openrasta-core\src\OpenRasta\OperationModel\MethodBased\MethodBasedOperation.cs:line 56
4-[2011-10-10 02:27:52Z] Error(0) at OpenRasta.OperationModel.Interceptors.OperationWithInterceptors.<Invoke>b__0() in C:\Users\hochmuth\Repositories\openrasta-core\src\OpenRasta\OperationModel\Interceptors\OperationWithInterceptors.cs:line 47
4-[2011-10-10 02:27:52Z] Error(0) at OpenRasta.OperationModel.Interceptors.OperationWithInterceptors.Invoke() in C:\Users\hochmuth\Repositories\openrasta-core\src\OpenRasta\OperationModel\Interceptors\OperationWithInterceptors.cs:line 52
4-[2011-10-10 02:27:52Z] Error(0) at OpenRasta.OperationModel.OperationExecutor.Execute(IEnumerable`1 operations) in C:\Users\hochmuth\Repositories\openrasta-core\src\OpenRasta\OperationModel\OperationExecutor.cs:line 14
4-[2011-10-10 02:27:52Z] Error(0) at OpenRasta.Pipeline.Contributors.OperationInvokerContributor.ExecuteOperations(ICommunicationContext context) in C:\Users\hochmuth\Repositories\openrasta-core\src\OpenRasta\Pipeline\Contributors\OperationInvokerContributor.cs:line 29
4-[2011-10-10 02:27:52Z] Error(0) at OpenRasta.Pipeline.PipelineRunner.ExecuteContributor(ICommunicationContext context, ContributorCall call) in C:\Users\hochmuth\Repositories\openrasta-core\src\OpenRasta\Pipeline\PipelineRunner.cs:line 192
4-[2011-10-10 02:27:52Z] Stop(1) Exiting PipelineRunner
4-[2011-10-10 02:27:52Z] Error(0) Aborting the pipeline and rendering the errors.
4-[2011-10-10 02:27:52Z] Error(0) An error has occurred and the processing of the request has stopped.
Exception:
System.InvalidOperationException: The operation is not ready for invocation.
at OpenRasta.OperationModel.MethodBased.MethodBasedOperation.Invoke() in C:\Users\hochmuth\Repositories\openrasta-core\src\OpenRasta\OperationModel\MethodBased\MethodBasedOperation.cs:line 56
at OpenRasta.OperationModel.Interceptors.OperationWithInterceptors.<Invoke>b__0() in C:\Users\hochmuth\Repositories\openrasta-core\src\OpenRasta\OperationModel\Interceptors\OperationWithInterceptors.cs:line 47
at OpenRasta.OperationModel.Interceptors.OperationWithInterceptors.Invoke() in C:\Users\hochmuth\Repositories\openrasta-core\src\OpenRasta\OperationModel\Interceptors\OperationWithInterceptors.cs:line 52
at OpenRasta.OperationModel.OperationExecutor.Execute(IEnumerable`1 operations) in C:\Users\hochmuth\Repositories\openrasta-core\src\OpenRasta\OperationModel\OperationExecutor.cs:line 14
at OpenRasta.Pipeline.Contributors.OperationInvokerContributor.ExecuteOperations(ICommunicationContext context) in C:\Users\hochmuth\Repositories\openrasta-core\src\OpenRasta\Pipeline\Contributors\OperationInvokerContributor.cs:line 29
at OpenRasta.Pipeline.PipelineRunner.ExecuteContributor(ICommunicationContext context, ContributorCall call) in C:\Users\hochmuth\Repositories\openrasta-core\src\OpenRasta\Pipeline\PipelineRunner.cs:line 192
4-[2011-10-10 02:27:52Z] Verbose(0) Pipeline is in RenderNow mode.
4-[2011-10-10 02:27:52Z] Start(1) Entering PipelineRunner: Executing contributor OperationResultInvokerContributor.RunOperationResult
4-[2011-10-10 02:27:52Z] Information(0) Executing OperationResult OperationResult: type=InternalServerError, statusCode=500.
4-[2011-10-10 02:27:52Z] Stop(1) Exiting PipelineRunner
4-[2011-10-10 02:27:52Z] Start(1) Entering PipelineRunner: Executing contributor ResponseEntityCodecResolverContributor.FindResponseCodec
4-[2011-10-10 02:27:52Z] Information(0) Selected codec HtmlErrorCodec out of 2 codecs for entity of type ServerErrorList and negotiated media type text/html; q=0.5.
4-[2011-10-10 02:27:52Z] Stop(1) Exiting PipelineRunner
4-[2011-10-10 02:27:52Z] Start(1) Entering PipelineRunner: Executing contributor AuthenticationChallengerContributor.ChallengeIfUnauthorized
4-[2011-10-10 02:27:52Z] Stop(1) Exiting PipelineRunner
4-[2011-10-10 02:27:52Z] Start(1) Entering PipelineRunner: Executing contributor ResponseEntityWriterContributor.WriteResponse
4-[2011-10-10 02:27:52Z] Verbose(0) Codec HtmlErrorCodec selected.
4-[2011-10-10 02:27:52Z] Start(1) Entering ResponseEntityWriterContributor: Generating response entity.
4-[2011-10-10 02:27:52Z] Verbose(0) Setting Content-Length to 2159
4-[2011-10-10 02:27:52Z] Stop(1) Exiting ResponseEntityWriterContributor
4-[2011-10-10 02:27:52Z] Verbose(0) Writing http headers.
4-[2011-10-10 02:27:52Z] Verbose(0) Writing http header Content-Length:2159
4-[2011-10-10 02:27:52Z] Verbose(0) Writing http header Content-Type:text/html
4-[2011-10-10 02:27:52Z] Stop(1) Exiting PipelineRunner
4-[2011-10-10 02:27:52Z] Information(0) Pipeline finished.
4-[2011-10-10 02:27:52Z] Stop(1) Exiting OpenRastaIntegratedHandler
4-[2011-10-10 02:27:52Z] Stop(1) Exiting OpenRastaRewriterHandler
4-[2011-10-10 02:27:52Z] Verbose(0) Request finished.
The thread '<No Name>' (0x1f68) has exited with code 0 (0x0).
I'm trying to handle a POST of a multipart document in OpenRasta with a URI template declaration of /content/{contentId}, but it fails. The configuration is
ResourceSpace.Has.ResourcesOfType<Content>().AtUri("/content/{contentId}").HandledBy<ContentHandler>().RenderedByAspx("~/Views/ContentView.aspx").And.AsJsonDataContract();
The handler method is as follows:
public OperationResult Post(string contentId, IEnumerable<IMultipartHttpEntity> entities) {...}
I'm using the following curl command to test
./curl -v -F myPartName=@./hello.txt http://localhost:10247/content/id-1
The POST works fine if I remove "{contentId}" from the URI template and modify the handler accordingly.
Any ideas on how to resolve? Log file follows below. Thanks --Roland
4-[2011-10-10 02:27:47Z] Verbose(0) Starts pre-executing the request.
4-[2011-10-10 02:27:47Z] Verbose(0) Incoming host request for http://localhost:10247/content/id-1
4-[2011-10-10 02:27:47Z] Verbose(0) Adding communication context data
4-[2011-10-10 02:27:47Z] Warning(0) Contributor call for BootstrapperContributor had a null Action.
4-[2011-10-10 02:27:47Z] Start(1) Entering PipelineRunner: Executing contributor HttpMethodOverriderContributor.OverrideHttpVerb
4-[2011-10-10 02:27:47Z] Stop(1) Exiting PipelineRunner
4-[2011-10-10 02:27:47Z] Start(1) Entering PipelineRunner: Executing contributor AuthenticationContributor.AuthoriseRequest
4-[2011-10-10 02:27:47Z] Stop(1) Exiting PipelineRunner
4-[2011-10-10 02:27:47Z] Start(1) Entering PipelineRunner: Executing contributor UriDecoratorsContributor.ProcessDecorators
4-[2011-10-10 02:27:47Z] Stop(1) Exiting PipelineRunner
4-[2011-10-10 02:27:47Z] Start(1) Entering PipelineRunner: Executing contributor ResourceTypeResolverContributor.ResolveResource
4-[2011-10-10 02:27:51Z] Stop(1) Exiting PipelineRunner
4-[2011-10-10 02:27:51Z] Verbose(0) Rewrote path.
4-[2011-10-10 02:27:51Z] Start(1) Entering OpenRastaRewriterHandler: Rewriting to original path
4-[2011-10-10 02:27:51Z] Start(1) Entering OpenRastaIntegratedHandler: Request for http://localhost:10247/content/id-1
4-[2011-10-10 02:27:51Z] Verbose(0) Incoming host request for http://localhost:10247/content/id-1
4-[2011-10-10 02:27:51Z] Verbose(0) Adding communication context data
4-[2011-10-10 02:27:51Z] Start(1) Entering PipelineRunner: Executing contributor HandlerResolverContributor.ResolveHandler
4-[2011-10-10 02:27:51Z] Stop(1) Exiting PipelineRunner
4-[2011-10-10 02:27:51Z] Start(1) Entering PipelineRunner: Executing contributor OperationCreatorContributor.CreateOperations
4-[2011-10-10 02:27:51Z] Verbose(0) Created operation named Get with signature ContentHandler::Get(String contentId)
4-[2011-10-10 02:27:51Z] Verbose(0) Created operation named Post with signature ContentHandler::Post(String contentId, IEnumerable`1 entities)
4-[2011-10-10 02:27:51Z] Stop(1) Exiting PipelineRunner
4-[2011-10-10 02:27:51Z] Start(1) Entering PipelineRunner: Executing contributor OperationFilterContributor.ProcessOperations
4-[2011-10-10 02:27:51Z] Verbose(0) Found 1 operation(s) with a matching name.
4-[2011-10-10 02:27:51Z] Verbose(0) Found 0 operation(s) with matching [HttpOperation] attribute.
4-[2011-10-10 02:27:51Z] Verbose(0) No resource or no uri name. Not filtering.
4-[2011-10-10 02:27:51Z] Stop(1) Exiting PipelineRunner
4-[2011-10-10 02:27:51Z] Start(1) Entering PipelineRunner: Executing contributor OperationCodecSelectorContributor.ProcessOperations
4-[2011-10-10 02:27:51Z] Information(0) Operation ContentHandler::Post(String contentId, IEnumerable`1 entities) selected with 2 required members and 0 optional members, with codec MultipartFormDataKeyedValuesCodec with score 1.5.
4-[2011-10-10 02:27:51Z] Stop(1) Exiting PipelineRunner
4-[2011-10-10 02:27:51Z] Start(1) Entering PipelineRunner: Executing contributor OperationHydratorContributor.ProcessOperations
4-[2011-10-10 02:27:51Z] Information(0) Operation ContentHandler::Post(String contentId, IEnumerable`1 entities) was selected with a codec score of 1.5
4-[2011-10-10 02:27:51Z] Information(0) Loaded codec OpenRasta.Codecs.MultipartFormDataKeyedValuesCodec
4-[2011-10-10 02:27:51Z] Information(0) Codec supports IKeyedValuesMediaTypeReader. Processing parameters.
4-[2011-10-10 02:27:51Z] Verbose(0) Seeking to next available part
4-[2011-10-10 02:27:51Z] Verbose(0) Skip the preamble. AtPreamble was True.
4-[2011-10-10 02:27:51Z] Verbose(0) not null
4-[2011-10-10 02:27:51Z] Verbose(0) Preamble found: True of size 0
4-[2011-10-10 02:27:51Z] Verbose(0) not null
4-[2011-10-10 02:27:51Z] Verbose(0) not null
4-[2011-10-10 02:27:51Z] Verbose(0) not null
4-[2011-10-10 02:27:51Z] Verbose(0) Skip the preamble. AtPreamble was False.
4-[2011-10-10 02:27:51Z] Verbose(0) Preamble found: False of size 0
4-[2011-10-10 02:27:51Z] Verbose(0) not null
4-[2011-10-10 02:27:51Z] Verbose(0) not null
4-[2011-10-10 02:27:51Z] Verbose(0) Seeking to next available part
4-[2011-10-10 02:27:51Z] Verbose(0) not null
4-[2011-10-10 02:27:51Z] Verbose(0) not null
4-[2011-10-10 02:27:51Z] Verbose(0) Key myPartName was not successfully assigned.
4-[2011-10-10 02:27:51Z] Verbose(0) Key myPartName was not successfully assigned.
4-[2011-10-10 02:27:51Z] Stop(1) Exiting PipelineRunner
4-[2011-10-10 02:27:51Z] Start(1) Entering PipelineRunner: Executing contributor OperationInterceptorContributor.WrapOperations
4-[2011-10-10 02:27:51Z] Stop(1) Exiting PipelineRunner
4-[2011-10-10 02:27:51Z] Start(1) Entering PipelineRunner: Executing contributor OperationInvokerContributor.ExecuteOperations
4-[2011-10-10 02:27:51Z] Verbose(0) Ignoring constructor, following dependencies didn't have a registration:OpenRasta.OperationModel.Interceptors.IOperationInterceptor[]
A first chance exception of type 'System.InvalidOperationException' occurred in OpenRasta.DLL
4-[2011-10-10 02:27:52Z] Error(0) An error of type System.InvalidOperationException has been thrown
4-[2011-10-10 02:27:52Z] Error(0) System.InvalidOperationException: The operation is not ready for invocation.
4-[2011-10-10 02:27:52Z] Error(0) at OpenRasta.OperationModel.MethodBased.MethodBasedOperation.Invoke() in C:\Users\hochmuth\Repositories\openrasta-core\src\OpenRasta\OperationModel\MethodBased\MethodBasedOperation.cs:line 56
4-[2011-10-10 02:27:52Z] Error(0) at OpenRasta.OperationModel.Interceptors.OperationWithInterceptors.<Invoke>b__0() in C:\Users\hochmuth\Repositories\openrasta-core\src\OpenRasta\OperationModel\Interceptors\OperationWithInterceptors.cs:line 47
4-[2011-10-10 02:27:52Z] Error(0) at OpenRasta.OperationModel.Interceptors.OperationWithInterceptors.Invoke() in C:\Users\hochmuth\Repositories\openrasta-core\src\OpenRasta\OperationModel\Interceptors\OperationWithInterceptors.cs:line 52
4-[2011-10-10 02:27:52Z] Error(0) at OpenRasta.OperationModel.OperationExecutor.Execute(IEnumerable`1 operations) in C:\Users\hochmuth\Repositories\openrasta-core\src\OpenRasta\OperationModel\OperationExecutor.cs:line 14
4-[2011-10-10 02:27:52Z] Error(0) at OpenRasta.Pipeline.Contributors.OperationInvokerContributor.ExecuteOperations(ICommunicationContext context) in C:\Users\hochmuth\Repositories\openrasta-core\src\OpenRasta\Pipeline\Contributors\OperationInvokerContributor.cs:line 29
4-[2011-10-10 02:27:52Z] Error(0) at OpenRasta.Pipeline.PipelineRunner.ExecuteContributor(ICommunicationContext context, ContributorCall call) in C:\Users\hochmuth\Repositories\openrasta-core\src\OpenRasta\Pipeline\PipelineRunner.cs:line 192
4-[2011-10-10 02:27:52Z] Stop(1) Exiting PipelineRunner
4-[2011-10-10 02:27:52Z] Error(0) Aborting the pipeline and rendering the errors.
4-[2011-10-10 02:27:52Z] Error(0) An error has occurred and the processing of the request has stopped.
Exception:
System.InvalidOperationException: The operation is not ready for invocation.
at OpenRasta.OperationModel.MethodBased.MethodBasedOperation.Invoke() in C:\Users\hochmuth\Repositories\openrasta-core\src\OpenRasta\OperationModel\MethodBased\MethodBasedOperation.cs:line 56
at OpenRasta.OperationModel.Interceptors.OperationWithInterceptors.<Invoke>b__0() in C:\Users\hochmuth\Repositories\openrasta-core\src\OpenRasta\OperationModel\Interceptors\OperationWithInterceptors.cs:line 47
at OpenRasta.OperationModel.Interceptors.OperationWithInterceptors.Invoke() in C:\Users\hochmuth\Repositories\openrasta-core\src\OpenRasta\OperationModel\Interceptors\OperationWithInterceptors.cs:line 52
at OpenRasta.OperationModel.OperationExecutor.Execute(IEnumerable`1 operations) in C:\Users\hochmuth\Repositories\openrasta-core\src\OpenRasta\OperationModel\OperationExecutor.cs:line 14
at OpenRasta.Pipeline.Contributors.OperationInvokerContributor.ExecuteOperations(ICommunicationContext context) in C:\Users\hochmuth\Repositories\openrasta-core\src\OpenRasta\Pipeline\Contributors\OperationInvokerContributor.cs:line 29
at OpenRasta.Pipeline.PipelineRunner.ExecuteContributor(ICommunicationContext context, ContributorCall call) in C:\Users\hochmuth\Repositories\openrasta-core\src\OpenRasta\Pipeline\PipelineRunner.cs:line 192
4-[2011-10-10 02:27:52Z] Verbose(0) Pipeline is in RenderNow mode.
4-[2011-10-10 02:27:52Z] Start(1) Entering PipelineRunner: Executing contributor OperationResultInvokerContributor.RunOperationResult
4-[2011-10-10 02:27:52Z] Information(0) Executing OperationResult OperationResult: type=InternalServerError, statusCode=500.
4-[2011-10-10 02:27:52Z] Stop(1) Exiting PipelineRunner
4-[2011-10-10 02:27:52Z] Start(1) Entering PipelineRunner: Executing contributor ResponseEntityCodecResolverContributor.FindResponseCodec
4-[2011-10-10 02:27:52Z] Information(0) Selected codec HtmlErrorCodec out of 2 codecs for entity of type ServerErrorList and negotiated media type text/html; q=0.5.
4-[2011-10-10 02:27:52Z] Stop(1) Exiting PipelineRunner
4-[2011-10-10 02:27:52Z] Start(1) Entering PipelineRunner: Executing contributor AuthenticationChallengerContributor.ChallengeIfUnauthorized
4-[2011-10-10 02:27:52Z] Stop(1) Exiting PipelineRunner
4-[2011-10-10 02:27:52Z] Start(1) Entering PipelineRunner: Executing contributor ResponseEntityWriterContributor.WriteResponse
4-[2011-10-10 02:27:52Z] Verbose(0) Codec HtmlErrorCodec selected.
4-[2011-10-10 02:27:52Z] Start(1) Entering ResponseEntityWriterContributor: Generating response entity.
4-[2011-10-10 02:27:52Z] Verbose(0) Setting Content-Length to 2159
4-[2011-10-10 02:27:52Z] Stop(1) Exiting ResponseEntityWriterContributor
4-[2011-10-10 02:27:52Z] Verbose(0) Writing http headers.
4-[2011-10-10 02:27:52Z] Verbose(0) Writing http header Content-Length:2159
4-[2011-10-10 02:27:52Z] Verbose(0) Writing http header Content-Type:text/html
4-[2011-10-10 02:27:52Z] Stop(1) Exiting PipelineRunner
4-[2011-10-10 02:27:52Z] Information(0) Pipeline finished.
4-[2011-10-10 02:27:52Z] Stop(1) Exiting OpenRastaIntegratedHandler
4-[2011-10-10 02:27:52Z] Stop(1) Exiting OpenRastaRewriterHandler
4-[2011-10-10 02:27:52Z] Verbose(0) Request finished.
The thread '<No Name>' (0x1f68) has exited with code 0 (0x0).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
从日志中,您可以看到多部分编解码器正在键/值处理模式下使用。在该模式下,将解析多部分的内容而不是分配 IEnumerable,这当然是该编解码器的问题。
我在 https://github.com/openrasta/ 添加了一个错误来解决此问题openrasta-core/issues/32
同时,您可以让多部分编解码器根据需要反序列化内容(您可以通过简单地将 DTO 或输入参数映射到表单实体的名称来使用,OpenWrap 将让你将表单数据分配给标准属性以及文件的 IFile 或 Stream)。
或者,根据您的需要,您可以通过覆盖依赖项注册器来取消注册键/值多部分编解码器,并让仅对象注册正常工作。
From the log, you can see that the multipart codec is being used in key/value processsing mode. In that mode, the content of the multipart is being parsed instead of assigning the IEnumerable, and that certainly is an issue with that codec.
I've added a bug to fix this issue at https://github.com/openrasta/openrasta-core/issues/32
In the meantime, you can let the multipart codec deserialize the content as needed (which you can use by simply mapping a DTO or input parameters to the names of the form entities, OpenWrap will let you assign form data into standard properties and IFile or Stream for files).
Alternatively, depending on your needs, you can unregister the key/value mutlipart codec by overriding the dependency registrar and let the object-only registration work as normal.