我讲demo中的接口
[Command(Strategy = StrategyType.Injection, Injection = @"return
new Surging.IModuleServices.Common.Models.UserModel
{
Name=""fanly"",
Age=19
};", InjectionNamespaces = new string[] { "Surging.IModuleServices.Common" }, RequestCacheEnabled = true)]
[Service(Date = "2017-8-11", Director = "fanly", Name = "获取用户")]
[InterceptMethod(CachingMethod.Get, Key = "GetUser_id_0", CacheSectionType = SectionType.ddlCache, Mode = CacheTargetType.Redis, Time = 480)]
Task GetUser(UserModel user);
属性RequestCacheEnabled 修改为true 想进入InterceptMethod 查看操作缓存的过程,结果报错,麻烦给看看是怎么回事,配置哪里有问题么?
===================================================
NullReferenceException: Object reference not set to an instance of an object.
Surging.Core.ProxyGenerator.Interceptors.Implementation.InterceptorProvider.GetInvocation(object proxy, IDictionary<string, object> parameters, string serviceId, Type returnType) in InterceptorProvider.cs
+
{
var entry = (from q in _serviceEntryManager.GetEntries()
let k = q.Attributes
where q.Descriptor.Id == serviceId
select q).FirstOrDefault();
var constructor = InvocationMethods.CompositionInvocationConstructor;
return constructor.Invoke(new object[]{
parameters,
serviceId,
GetKey(parameters),
entry.Attributes,
returnType,
proxy
Surging.Core.ProxyGenerator.Implementation.ServiceProxyBase.GetInvocation(IDictionary<string, object> parameters, string serviceId, Type returnType) in ServiceProxyBase.cs
+
}
}
private IInvocation GetInvocation(IDictionary<string, object> parameters, string serviceId, Type returnType)
{
var invocation = _serviceProvider.GetInstances<IInterceptorProvider>();
return invocation.GetInvocation(this, parameters, serviceId, returnType);
}
#endregion Protected Method
}
}
Surging.Core.ProxyGenerator.Implementation.ServiceProxyBase+d__8.MoveNext() in ServiceProxyBase.cs
+
var invoker = _serviceProvider.GetInstances(command.Strategy.ToString());
return await invoker.Invoke(parameters, serviceId, _serviceKey, typeof(T) == typeof(Object));
}
}
else
{
var invocation = GetInvocation(parameters, serviceId, typeof(T));
await _interceptor.Intercept(invocation);
message = invocation.ReturnValue is RemoteInvokeResultMessage
? invocation.ReturnValue as RemoteInvokeResultMessage : null;
result = invocation.ReturnValue;
}
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
System.Runtime.CompilerServices.TaskAwaiter.GetResult()
Surging.Core.ProxyGenerator.Implementation.RemoteServiceProxy+d__2.MoveNext() in RemoteServiceProxy.cs
+
{
}
public new async Task Invoke(IDictionary<string, object> parameters, string serviceId)
{
return await base.Invoke(parameters, serviceId);
}
}
}
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
System.Runtime.CompilerServices.TaskAwaiter.GetResult()
Surging.Core.ProxyGenerator.Implementation.ServiceProxyProvider+d__3.MoveNext() in ServiceProxyProvider.cs
+
var proxy= new RemoteServiceProxy(parameters["serviceKey"].ToString(), _serviceProvider);
result = await proxy.Invoke(parameters, serviceRoute.ServiceDescriptor.Id);
}
else
{
var proxy = new RemoteServiceProxy(null, _serviceProvider);
result = await proxy.Invoke(parameters, serviceRoute.ServiceDescriptor.Id);
}
return result;
}
public async Task Invoke(IDictionary<string, object> parameters, string routePath, string serviceKey)
{
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
System.Runtime.CompilerServices.TaskAwaiter.GetResult()
Surging.ApiGateway.Controllers.ServicesController+d__4.MoveNext() in ServicesController.cs
+
result = ServiceResult.Create(true, await _serviceProxyProvider.Invoke(model, path, serviceKey));
result.StatusCode = (int)ServiceStatusCode.Success;
}
else
{
result = ServiceResult.Create(true, await _serviceProxyProvider.Invoke(model, path));
result.StatusCode = (int)ServiceStatusCode.Success;
}
}
}
return result;
}
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
lambda_method(Closure , object )
Microsoft.Extensions.Internal.ObjectMethodExecutorAwaitable+Awaiter.GetResult()
Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker+d__12.MoveNext()
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker+d__10.MoveNext()
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)
Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted)
Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker+d__14.MoveNext()
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker+d__22.MoveNext()
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context)
Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted)
Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker+d__17.MoveNext()
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker+d__15.MoveNext()
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Microsoft.AspNetCore.Builder.RouterMiddleware+d__4.MoveNext()
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware+d__7.MoveNext()
Show raw exception details
System.NullReferenceException: Object reference not set to an instance of an object.
at Surging.Core.ProxyGenerator.Interceptors.Implementation.InterceptorProvider.GetInvocation(Object proxy, IDictionary2 parameters, String serviceId, Type returnType) in E:\work\TechnicalPointSurvey\surging\surging-master\src\Surging.Core\Surging.Core.ProxyGenerator\Interceptors\Implementation\InterceptorProvider.cs:line 30 at Surging.Core.ProxyGenerator.Implementation.ServiceProxyBase.GetInvocation(IDictionary
2 parameters, String serviceId, Type returnType) in E:\work\TechnicalPointSurvey\surging\surging-master\src\Surging.Core\Surging.Core.ProxyGenerator\Implementation\ServiceProxyBase.cs:line 114
at Surging.Core.ProxyGenerator.Implementation.ServiceProxyBase.d__81.MoveNext() in E:\work\TechnicalPointSurvey\surging\surging-master\src\Surging.Core\Surging.Core.ProxyGenerator\Implementation\ServiceProxyBase.cs:line 69 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter
1.GetResult()
at Surging.Core.ProxyGenerator.Implementation.RemoteServiceProxy.d__21.MoveNext() in E:\work\TechnicalPointSurvey\surging\surging-master\src\Surging.Core\Surging.Core.ProxyGenerator\Implementation\RemoteServiceProxy.cs:line 32 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter
1.GetResult()
at Surging.Core.ProxyGenerator.Implementation.ServiceProxyProvider.d__31.MoveNext() in E:\work\TechnicalPointSurvey\surging\surging-master\src\Surging.Core\Surging.Core.ProxyGenerator\Implementation\ServiceProxyProvider.cs:line 31 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter
1.GetResult()
at Surging.ApiGateway.Controllers.ServicesController.d__4.MoveNext() in E:\work\TechnicalPointSurvey\surging\surging-master\src\Surging.ApiGateway\Controllers\ServicesController.cs:line 64
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at lambda_method(Closure , Object )
at Microsoft.Extensions.Internal.ObjectMethodExecutorAwaitable.Awaiter.GetResult()
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.d__12.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.d__10.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.d__14.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.d__22.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context)
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.d__17.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.d__15.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Builder.RouterMiddleware.d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.d__7.MoveNext()