【问题标题】:Grpc: C# server as a Windows Service is it possible?Grpc:C# 服务器作为 Windows 服务是否可能?
【发布时间】:2017-02-27 23:22:05
【问题描述】:

我试图将 C# Grpc 服务器的源代码传递到 Windows 服务项目中。 在these steps 之后,但是当我执行 InstallUtil MyService.exe 时,进程停止指示

System.Reflection.ReflectionTypeLoadException: No se pueden cargar uno o varios
tipos requeridos. Recupere la propiedad LoaderExceptions para obtener más información.

我该如何解决?

【问题讨论】:

    标签: c# windows-services grpc


    【解决方案1】:

    尝试将项目引用的 Copy Local 属性设置为 true。

    更多信息在这里:Error message 'Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.'

    【讨论】:

      【解决方案2】:

      InstallUtil 用于安装 windows 服务,我们之前在 .net 框架中使用该服务。由于这将在 .net Core 中,我们需要使用 cs 命令。

      以下是您可以使用的示例命令:

      sc.exe create NewServiceName binpath=pathOfExe
      

      您需要使用以下链接中指定的 CS 命令,因为这是一个 .net Core 应用程序。

      https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/sc-create

      【讨论】:

      • 您的答案可以通过额外的支持信息得到改进。请edit 添加更多详细信息,例如引用或文档,以便其他人可以确认您的答案是正确的。你可以找到更多关于如何写好答案的信息in the help center
      猜你喜欢
      • 1970-01-01
      • 2014-12-18
      • 2012-01-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多