2016-11-30 10 views
2
私は次のメッセージが出てい

:オブジェクトのインスタンスに設定されていないオブジェクト参照がオブジェクトインスタンスに設定されていないサービスの例外servicestack

オブジェクト参照を

サービスによってスローされた例外をログに記録しようとすると、私は次のサービス例外ハンドラを使用しています私のApphostBaseで

ServiceExceptionHandlers.Add((httpReq, request, exception) => { 
    Logger.Error(exception); 
    return DtoUtils.CreateErrorResponse(request, exception); 
}); 

例外はtですServiceStack.dll

at ServiceStack.DtoUtils.CreateErrorResponse(Object request, Exception ex) 
    at MyApp.<>c.<Configure>b__3_16(IRequest httpReq, Object request, Exception exception) in C:\Users\Company\Documents\Visual Studio 2015\Projects\MyApp\src\MyApp\MyApp\AppHost.cs:line 175 
    at ServiceStack.ServiceStackHost.OnServiceException(IRequest httpReq, Object request, Exception ex) 
    at ServiceStack.Host.ServiceRunner`1.HandleException(IRequest request, TRequest requestDto, Exception ex) 
    at ServiceStack.Host.ServiceRunner`1.Execute(IRequest request, Object instance, TRequest requestDto) 
    at ServiceStack.Host.ServiceRunner`1.Process(IRequest requestContext, Object instance, Object request) 
    at ServiceStack.Host.ServiceExec`1.Execute(IRequest request, Object instance, Object requestDto, String requestName) 
    at ServiceStack.Host.ServiceRequestExec`2.Execute(IRequest requestContext, Object instance, Object request) 
    at ServiceStack.Host.ServiceController.<>c__DisplayClass37_1.<RegisterServiceExecutor>b__1(IRequest reqCtx, Object requestDto) 
    at ServiceStack.Host.ServiceController.ManagedServiceExec(ServiceExecFn serviceExec, IService service, IRequest request, Object requestDto) 
    at ServiceStack.Host.ServiceController.<>c__DisplayClass37_0.<RegisterServiceExecutor>b__0(IRequest req, Object dto) 
    at ServiceStack.Host.ServiceController.Execute(Object requestDto, IRequest req) 
    at ServiceStack.HostContext.ExecuteService(Object request, IRequest httpReq) 
    at ServiceStack.Host.RestHandler.GetResponse(IRequest request, Object requestDto) 
    at ServiceStack.Host.RestHandler.ProcessRequestAsync(IRequest httpReq, IResponse httpRes, String operationName) 

ライン175でhrownです:

return DtoUtils.CreateErrorResponse(request, exception); 

要求と例外の両方が値を持っています。私はmvcアプリケーションを実行しているし、またServiceStack.HttpHandlerFactoryで処理されるAPIを消費しています。私はServiceStackのV4.5

enter image description here

答えて

1

を使用していることServiceStackの最新v4.5.4リリースから提供されていますNullReferenceException issue resolved in this commitがありました。

+0

フレームワークをバージョン4.5.4にアップグレードしても同じエラーが表示される –

+0

@ HerberVesquez okですが、ここから問題が何であるかはわかりません(例:[CreateErrorResponse() ServiceExceptionHandlers](https://github.com/ServiceStack/ServiceStack/blob/f13104ffa1156f543f67ad4e27fdb3070c297e0f/tests/ServiceStack.WebHost.Endpoints.Tests/CacheResponseTests.cs#L209))。問題を示す小さなスタンドアロンプ​​ロジェクト(Githubリポジトリなど)をまとめることができれば、問題を特定して解決することができます。 – mythz

関連する問題