System.ExecutionEngineException' 发生在 mscorlib.dll

如何解决System.ExecutionEngineException' 发生在 mscorlib.dll

我正在尝试使用 C# 和服务结构在 .NET Framework 上运行一个简单的 Client Servier Communicaton 应用程序。对于服务间通信,我尝试使用 gRPC,并且我已将客户端和服务器作为集群上的单独服务.我正在使用可靠的服务 API 来覆盖功能并建立服务间通信。但是,当我运行代码时,出现此错误:-

Exception thrown: 'Grpc.Core.RpcException' in mscorlib.dll
Managed Debugging Assistant 'FatalExecutionEngineError' has detected a problem in
 'C:\Users\Administrator\source\repos\TestGRPC\ClientService\bin\x64\Debug\ClientService.exe'.

Additional information: The runtime has encountered a Fatal error. The address of the error was at 0xeed5af27,on thread 0x578. The error code is 0x80131623.
This error may be a bug in the CLR or in the unsafe or non-verifiable portions of user code.
Common sources of this bug include user marshaling errors for COM-interop or PInvoke,which may corrupt the stack.
An unhandled exception of type 'System.ExecutionEngineException' occurred in mscorlib.dll

然后我找出了导致这个错误的那一行:-

static Random mRand = new Random();
        protected override async Task RunAsync(CancellationToken cancellationToken)
        {
            long iterations = 0;
            ServicePartitionResolver partitionResolver = new ServicePartitionResolver("localhost:19000");
            var partition = partitionResolver.ResolveAsync(new Uri("fabric:/TestGRPC/gRPCServer"),ServicePartitionKey.Singleton,new System.Threading.CancellationToken()).Result;
            var endpoint = partition.Endpoints.ElementAt(mRand.Next(0,partition.Endpoints.Count));

            var address = endpoint.Address.Substring(endpoint.Address.IndexOf("\"\":\"") + 4);
            address = address.Substring(0,address.IndexOf("\""));

            Channel channel = new Channel(address,ChannelCredentials.Insecure);
            var client = new AccountService.AccountServiceClient(channel);
            while (true)
            {
                cancellationToken.ThrowIfCancellationRequested();
                EmployeeName empName = client.GetEmployeeName(new EmployeeNameRequest { EmpId = "1" });
                if (empName == null || string.IsNullOrWhiteSpace(empName.FirstName) || string.IsNullOrWhiteSpace(empName.LastName))
                {
                    ServiceEventSource.Current.ServiceMessage(this.Context,"Emplyee Not found");
                    Console.WriteLine("Employee not found.");
                }
                else
                {
                    ServiceEventSource.Current.ServiceMessage(this.Context,"Emplyee Name: {0} {1}",empName.FirstName,empName.LastName);
                    Console.WriteLine($"The employee name is {empName.FirstName} {empName.LastName}.");
                }
                ServiceEventSource.Current.ServiceMessage(this.Context,"Working-{0}",++iterations);

                await Task.Delay(TimeSpan.FromSeconds(1),cancellationToken);
            }
        }

是线

EmployeeName empName = client.GetEmployeeName(new EmployeeNameRequest { EmpId = "1" });

我怀疑域名没有被正确解析,或者我不知道如何生成正确的域名地址。警告消息中也有同样的指示。服务器似乎在集群上运行良好。 集群上显示的警告消息以及堆栈跟踪是:-

'RunAsync' reported Warning for property 'RunAsyncUnhandledException'.
Grpc.Core.RpcException: Status(StatusCode="Unavailable",Detail="DNS resolution Failed for service: MININT-H7Q1KHO:50001",DebugException="Grpc.Core.Internal.CoreErrorDetailException: {"created":"@1624221009.546000000","description":"Resolver transient failure","file":"..\..\..\src\core\ext\filters\client_channel\client_channel.cc","file_line":1361,"referenced_errors":[{"created":"@1624221009.546000000","description":"DNS resolution Failed for service: MININT-H7Q1KHO:50001","file":"..\..\..\src\core\ext\filters\client_channel\resolver\dns\c_ares\dns_resolver_ares.cc","file_line":362,"grpc_status":14,"referenced_errors":[{"created":"@1624221009.545000000","description":"C-ares status is not ARES_SUCCESS qtype=A name=MININT-H7Q1KHO is_balancer=0: Domain name not found","file":"..\..\..\src\core\ext\filters\client_channel\resolver\dns\c_ares\grpc_ares_wrapper.cc","file_line":724,"description":"C-ares status is not ARES_SUCCESS qtype=AAAA name=MININT-H7Q1KHO is_balancer=0: Domain name not found","file_line":724}]}]}]}")
   at System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Grpc.Core.Internal.AsyncCall`2.UnaryCall(TRequest msg) in /var/local/git/grpc/src/csharp/Grpc.Core/Internal/AsyncCall.cs:line 78
   at Grpc.Core.DefaultCallInvoker.BlockingUnaryCall[TRequest,TResponse](Method`2 method,String host,CallOptions options,TRequest request) in /var/local/git/grpc/src/csharp/Grpc.Core/DefaultCallInvoker.cs:line 46
   at Grpc.Core.Interceptors.InterceptingCallInvoker.<BlockingUnaryCall>b__3_0[TRequest,TResponse](TRequest req,ClientInterceptorContext`2 ctx) in /var/local/git/grpc/src/csharp/Grpc.Core.Api/Interceptors/InterceptingCallInvoker.cs:line 51
   at Grpc.Core.ClientBase.ClientBaseConfiguration.ClientBaseConfigurationInterceptor.BlockingUnaryCall[TRequest,TResponse](TRequest request,ClientInterceptorContext`2 context,BlockingUnaryCallContinuation`2 continuation) in /var/local/git/grpc/src/csharp/Grpc.Core.Api/ClientBase.cs:line 174
   at Grpc.Core.Interceptors.InterceptingCallInvoker.BlockingUnaryCall[TRequest,TRequest request) in /var/local/git/grpc/src/csharp/Grpc.Core.Api/Interceptors/InterceptingCallInvoker.cs:line 48
   at AccountService.AccountServiceClient.GetEmployeeName(EmployeeNameRequest request,CallOptions options) in C:\Users\Administrator\source\repos\TestGRPC\ClientService\AccountGrpc.cs:line 100
   at AccountService.AccountServiceClient.GetEmployeeName(EmployeeNameRequest request,Metadata headers,Nullable`1 deadline,CancellationToken cancellationToken) in C:\Users\Administrator\source\repos\TestGRPC\ClientService\AccountGrpc.cs:line 96
   at ClientService.ClientService.<RunAsync>d__3.MoveNext() in C:\Users\Administrator\source\repos\TestGRPC\ClientService\ClientService.cs:line 56
--- 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.ServiceFabric.Services.Runtime.StatelessServiceInstanceAdapter.<ExecuteRunAsync>d__18.MoveNext()

我被困在这个问题上很长时间了。我对SF有点陌生,不知道如何解决这个问题。任何帮助将不胜感激。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?
Java在半透明框架/面板/组件上重新绘画。
Java“ Class.forName()”和“ Class.forName()。newInstance()”之间有什么区别?
在此环境中不提供编译器。也许是在JRE而不是JDK上运行?
Java用相同的方法在一个类中实现两个接口。哪种接口方法被覆盖?
Java 什么是Runtime.getRuntime()。totalMemory()和freeMemory()?
java.library.path中的java.lang.UnsatisfiedLinkError否*****。dll
JavaFX“位置是必需的。” 即使在同一包装中
Java 导入两个具有相同名称的类。怎么处理?
Java 是否应该在HttpServletResponse.getOutputStream()/。getWriter()上调用.close()?
Java RegEx元字符(。)和普通点?