0

は、私がLinuxサービス・ファブリック・クラスタ上でそれをしようとすると、次のエラーサービスファブリックパッケージのアクティベーションエラー

Error event: SourceId='System.Hosting', 

Property='CodePackageActivation:Code:EntryPoint'. 
There was an error during CodePackage activation.Service host failed to activate. Error:0x800700c1` 

の取得、エラーがいくつかを変更します。だからWindowsクラスタは、Windowsがbashを持っていないので、entyPoint.shスクリプトで失敗しています。 Linuxクラスタはそれを過ぎて、初期化コードのどこかで失敗しているように見えますが、それでもどこを見つけることはできません。私は

<ConsoleRedirection FileRetentionCount="5" FileMaxSizeInKb="2048"/> 

のログをすべてダウンロードしましたが、そこにあるコンソールからは何も見えませんでした。

Error event: SourceId='System.Hosting', 

Property='CodePackageActivation:Code:EntryPoint'. 
There was an error during CodePackage activation.The service host terminated with exit code:134 

スタートアップクラスは

namespace MyApp 
{ 
    using System; 
    using System.Diagnostics; 
    using System.Threading; 
    using CommandLine; 
    using Microsoft.AspNetCore.Hosting; 
    using Microsoft.ServiceFabric.Services.Runtime; 

internal static class Program 
{ 
    /// <summary> 
    /// This is the entry point of the service host process. 
    /// </summary> 
    private static void Main(string[] args) 
    { 
     var parser = new Parser(with => 
     { 
      with.HelpWriter = Console.Out; 
     }); 

     var options = new Options(); 
     var result = parser.ParseArguments(args, options); 


     if (options.Host.ToLower() == MyAppConstants.ServiceFabricHost) 
     { 
      try 
      { 
       // The ServiceManifest.XML file defines one or more service type names. 
       // Registering a service maps a service type name to a .NET type. 
       // When Service Fabric creates an instance of this service type, 
       // an instance of the class is created in this host process. 

       ServiceRuntime.RegisterServiceAsync(
        "WebServiceType", 
        context => new MyApp(context)).GetAwaiter().GetResult(); 

       ServiceEventSource.Current.ServiceTypeRegistered(Process.GetCurrentProcess().Id, typeof(SnapNurse).Name); 

       // Prevents this host process from terminating so services keeps running. 
       Thread.Sleep(Timeout.Infinite); 
      } 
      catch (Exception e) 
      { 
       ServiceEventSource.Current.ServiceHostInitializationFailed(e.ToString()); 
       throw; 
      } 
     } 
     else if (options.Host.ToLower() == MyAppConstants.SelfHost) 
     { 
      using (var host = WebHostBuilderHelper.GetWebHost(new WebHostBuilder(), options.Protocol, options.Port)) 
      { 
       host.Run(); 
      } 
     } 
    } 
} 

Program.csの

namespace MyApp 
{ 
    using System.Collections.Generic; 
    using System.Fabric; 
    using System.IO; 
    using System.Net.Http; 
    using Microsoft.AspNetCore.Hosting; 
    using Microsoft.Extensions.DependencyInjection; 
    using Microsoft.ServiceFabric.Services.Communication.AspNetCore; 
    using Microsoft.ServiceFabric.Services.Communication.Runtime; 
    using Microsoft.ServiceFabric.Services.Runtime; 
/// <summary> 
/// The FabricRuntime creates an instance of this class for each service type instance. 
/// </summary> 
internal sealed class MyApp : StatelessService 
{ 
    public MyApp(StatelessServiceContext context) 
     : base(context) 
    { 
    } 

    /// <summary> 
    /// Optional override to create listeners (like tcp, http) for this service instance. 
    /// </summary> 
    /// <returns>The collection of listeners.</returns> 
    protected override IEnumerable<ServiceInstanceListener> CreateServiceInstanceListeners() 
    { 
     return new ServiceInstanceListener[] 
     { 
      new ServiceInstanceListener(
       serviceContext => 
        new KestrelCommunicationListener(
         serviceContext, 
         "ServiceEndpoint", 
         (url, listener) => 
         { 
          ServiceEventSource.Current.ServiceMessage(serviceContext, $"Starting WebListener on {url}"); 

          return new WebHostBuilder() 
           .UseKestrel() 
           .ConfigureServices(
            services => services 
             .AddSingleton<ConfigSettings>(new ConfigSettings(serviceContext)) 
             .AddSingleton<HttpClient>(new HttpClient()) 
             .AddSingleton<FabricClient>(new FabricClient()) 
             .AddSingleton<StatelessServiceContext>(serviceContext)) 
           .UseContentRoot(Directory.GetCurrentDirectory()) 
           .UseServiceFabricIntegration(listener, ServiceFabricIntegrationOptions.None) 
           .UseStartup<Startup>() 
           .UseUrls(url) 
           .Build(); 
         })) 
     }; 
    } 
} 

のように見える私は、エラーの詳細を見つけることができませんでした、そしてサービスで何かをデバッグすることはできませんファブリック環境で実行されないためです。どんな助けにも感謝!

私はPerfViewを実行しており、パッケージのアクティベーションに関連するイベントを検出しましたが、実際の問題のヒントは見つかりませんでした。たとえ問題が何であるかを知っている人がいなくても、より多くの情報を得るためのテクニックのほんの一部だけが素晴らしいでしょう!

もう1つのことは、Main()メソッドのすべてのコードをコメントアウトしても、まったく同じエラーが表示されることです。ほとんどの場合、フレームワークdllや何かのものにも到達する前に失敗しているようですが、すべてが.netcore2で、サービスファブリックを備えたマシンにランタイムがインストールされています

+0

スタートアップスクリプトには何が含まれていますか? – Dismissile

+0

オプションとは何でしょうか。サービスファブリックブランチを実行してみてください – Mardoxx

答えて

1

明らかに、これはLinuxの行末が異なるためですおよびWindows。 WindowsシステムではCR + LFが使用され、UNIXシステムとUnixライクシステムではLFが使用されます。あなたの問題を解決するために

sed -i -e 's/\r$//' entrypoint.sh 

を行うあなたはsed -i -e 's/\r$//' *.shができます他の.shのファイルならば、これを行うために必要がある場合があります。

次に、サービスファブリッククラスタの項目に進んでください!

人々はまた、unix2dosdos2unixのような問題については、多くの代替案が記載されているようなものを遊んでいます。here

関連する問題