-1

尝试运行使用带有 ASP.NET 核心无状态服务的 Service Fabric 模板创建的服务时,我收到“调用目标引发异常”。

下面是完整的堆栈跟踪,请让我知道我做错了什么

Exception has been thrown by the target of an invocation.
            at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
            at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
            at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProvider provider)
            at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider)
            at Microsoft.Extensions.DependencyInjection.ServiceProvider.<>c__DisplayClass22_0.<RealizeService>b__0(ServiceProvider provider)
            at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
            at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
            at Microsoft.AspNetCore.Hosting.Internal.WebHost.EnsureServer()
            at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
            at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build()
            at SLService.SLService.<>c__DisplayClass1_0.<CreateServiceInstanceListeners>b__1(String url, AspNetCoreCommunicationListener listener)
            at Microsoft.ServiceFabric.Services.Communication.AspNetCore.AspNetCoreCommunicationListener.OpenAsync(CancellationToken cancellationToken)
            at Microsoft.ServiceFabric.Services.Runtime.StatelessServiceInstanceAdapter.<OpenCommunicationListenersAsync>d__19.MoveNext()
            at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.Start[TStateMachine](TStateMachine& stateMachine)
            at Microsoft.ServiceFabric.Services.Runtime.StatelessServiceInstanceAdapter.OpenCommunicationListenersAsync(CancellationToken cancellationToken)
            at Microsoft.ServiceFabric.Services.Runtime.StatelessServiceInstanceAdapter.<System-Fabric-IStatelessServiceInstance-OpenAsync>d__13.MoveNext()
            at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.Start[TStateMachine](TStateMachine& stateMachine)
            at Microsoft.ServiceFabric.Services.Runtime.StatelessServiceInstanceAdapter.System.Fabric.IStatelessServiceInstance.OpenAsync(IStatelessServicePartition partition, CancellationToken cancellationToken)
            at System.Fabric.StatelessServiceBroker.OpenAsync(IFabricStatelessServicePartition partition, CancellationToken cancellationToken)
            at System.Fabric.StatelessServiceBroker.<>c__DisplayClass10_0.<System.Fabric.Interop.NativeRuntime.IFabricStatelessServiceInstance.BeginOpen>b__0(CancellationToken cancellationToken)
            at System.Fabric.Interop.Utility.WrapNativeAsyncMethodImplementation(Func`2 func, IFabricAsyncOperationCallback callback, String functionTag, InteropApi interopApi)
4

1 回答 1

0

请找到捕获的确切跟踪,

System.Reflection.TargetInvocationException occurred
HResult=0x80131604
Message=Exception has been thrown by the target of an invocation.
Source=mscorlib
StackTrace:
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.<>c__DisplayClass22_0.<RealizeService>b__0(ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
at Microsoft.AspNetCore.Hosting.Internal.WebHost.EnsureServer()
at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build()
at SLService.SLService.<>c__DisplayClass1_0.<CreateServiceInstanceListeners>b__1(String url, AspNetCoreCommunicationListener listener) in C:\Users\asupadhy\source\repos\SLCore\SLService\SLService.cs:line 38
at Microsoft.ServiceFabric.Services.Communication.AspNetCore.AspNetCoreCommunicationListener.OpenAsync(CancellationToken cancellationToken)
at Microsoft.ServiceFabric.Services.Runtime.StatelessServiceInstanceAdapter.<OpenCommunicationListenersAsync>d__19.MoveNext()
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.Start[TStateMachine](TStateMachine& stateMachine)
at Microsoft.ServiceFabric.Services.Runtime.StatelessServiceInstanceAdapter.OpenCommunicationListenersAsync(CancellationToken cancellationToken)
at Microsoft.ServiceFabric.Services.Runtime.StatelessServiceInstanceAdapter.<System-Fabric-IStatelessServiceInstance-OpenAsync>d__13.MoveNext()
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.Start[TStateMachine](TStateMachine& stateMachine)
at Microsoft.ServiceFabric.Services.Runtime.StatelessServiceInstanceAdapter.System.Fabric.IStatelessServiceInstance.OpenAsync(IStatelessServicePartition partition, CancellationToken cancellationToken)
at System.Fabric.StatelessServiceBroker.OpenAsync(IFabricStatelessServicePartition partition, CancellationToken cancellationToken)
at System.Fabric.StatelessServiceBroker.<>c__DisplayClass10_0.<System.Fabric.Interop.NativeRuntime.IFabricStatelessServiceInstance.BeginOpen>b__0(CancellationToken cancellationToken)
at System.Fabric.Interop.Utility.WrapNativeAsyncMethodImplementation(Func`2 func, IFabricAsyncOperationCallback callback, String functionTag, InteropApi interopApi)

内部异常 1:AccessViolationException:试图读取或写入受保护的内存。这通常表明其他内存已损坏。

于 2017-11-07T14:43:15.183 回答