2017-02-06 3 views
0

私はASPを使って動作するアプリケーションを持っています。コンソールは(WebアプリケーションではなくIISを使用して)コアを使用しています。 Windowsでは、常にすべてが正常に動作しています。しかし、私たちのサーバ(CentOS 7)で実行すると、ほとんどのリクエストは落とされます。CentOSサーバー上のASP .NETコアコンソールアプリケーションが要求を破棄します。

私の起動方法は次のとおりです。

 ... 
     var config = new ConfigurationBuilder() 
      .AddCommandLine(new string[] { $"--server.urls={urls}" }) 
      .Build(); 

     var host = new WebHostBuilder() 
      .UseConfiguration(config) 
      .UseKestrel() 
      .UseStartup<Listener>() 
      .UseLoggerFactory(loggerFactory) 
      .Build(); 

     host.Start(); 

     ConsoleKeyInfo key; 
     while ((key.Modifiers & ConsoleModifiers.Control) != ConsoleModifiers.Control && key.Key != ConsoleKey.Q) 
     { 
      key = Console.ReadKey(); 
     } 

     host.Dispose(); 

とリスナー:

public class Listener 
{ 
    ... 

    public void ConfigureServices(IServiceCollection collections) 
    { 
    } 

    public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) 
    { 
     app.Run(async (context) => 
     { 
      ... 

      context.Response.StatusCode = *** some response code *** 

      using (StreamWriter writer = new StreamWriter(context.Response.Body)) 
       await writer.WriteLineAsync(*** a response ***); 
     }); 
    } 
} 

カール

curl -v http://x.x.x.x:1234/ 

といくつかの要求をしようとするとその後の時間のほとんどは私が受け取る:

* timeout on name lookup is not supported 
* Trying x.x.x.x... 
    % Total % Received % Xferd Average Speed Time Time  Time Current 
          Dload Upload Total Spent Left Speed 
    0  0 0  0 0  0  0  0 --:--:-- --:--:-- --:--:--  0* connect to x.x.x.x port 1234 failed: Connection refused 
* Failed to connect to x.x.x.x port 1234: Connection refused 
* Closing connection 0 
curl: (7) Failed to connect to x.x.x.x port 1234: Connection refused 

ほとんどの場合、同じコマンドが動作することがあります。

そして、私はポストマンを使用している場合も、それは10の外〜9回作品..

私はどこにでも見て、誰も私に教えてくださいアイデアを持っている場合、私は本当に、迷ってしまいました。

答えて

0

問題が見つかりました。 ASP .netやCentOSとは関係ありません。それは私たちのファイアウォール(VPNの背後にあります)、ルーティングルールはポートの範囲によって設定されました。例:ip1 port 10000-10010 - > ip2 port 10000-10010。したがって、ip1ポート10001でメッセージが受信された場合、ip2ポート10001に送信されると想定しました。ただし、範囲内の任意のポートに送信されました。

関連する問題