-1

I am getting, "Exception has been thrown by the target of an invocation" when trying to run Service created using Service Fabric template with ASP.NET core Stateless Service.

Below is complete stack trace, please let me know what I am doing wrong

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)
Srini V
  • 11,045
  • 14
  • 66
  • 89

1 Answers1

0

Please find exact trace captured,

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)

Inner Exception 1: AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.