在Azure和.Net Core上运行时,服务器发送的事件中途停止

在Azure和.Net Core上运行时,服务器发送的事件中途停止,azure,.net-core,server-sent-events,Azure,.net Core,Server Sent Events,我有两个不同的页面提供长时间运行的HTTP服务器发送事件。当我在我的开发环境中运行时,它们都工作得很好。但是,当我发布到Azure时。。。然后,当我开始其中一个时,它会嗡嗡作响,直到我开始另一个,然后第一个会在中途停止。。。例如: data:{"Symbol":"AAWW","Last":["2019-06-30T02:03:16",44.63]} data:{"Symbol":"ACWF","Last":["2019-06-30T02:03:16",29.29]} data:{"Symbol"

我有两个不同的页面提供长时间运行的HTTP服务器发送事件。当我在我的开发环境中运行时,它们都工作得很好。但是,当我发布到Azure时。。。然后,当我开始其中一个时,它会嗡嗡作响,直到我开始另一个,然后第一个会在中途停止。。。例如:

data:{"Symbol":"AAWW","Last":["2019-06-30T02:03:16",44.63]}
data:{"Symbol":"ACWF","Last":["2019-06-30T02:03:16",29.29]}
data:{"Symbol":"AAME","Last":["2019-06-30T02:03:16",2.46]}
data:{"Symbol":"ABC","Last":["2019-06-30T02:03:16",85.28]}
data:{"Symbol":"ABEV","Last":["2019-0
我尝试捕捉错误,查看日志(见下文)。。。我不知道为什么会这样,甚至不知道为什么会这样。有什么帮助吗

****更新****

当我打第二个电话时,就这么简单。。。同样的事情也会发生

    [HttpGet]
    [Route("EquityCurve_Daily_WithRealtimeUpdates")]
    public void EquityCurve_Daily_WithRealtimeUpdates(CancellationToken cancellationToken, long tradingAccountId, string securityKey)
    {
        var xx = new ManualResetEventSlim(false);
        xx.Wait(cancellationToken);
    }
其中一个的控制器代码是:(它们都非常相似):

GetPricesData_LastClose和Altime基本上是这样做的:

            PriceServer.Instance.Connect(subscriber, (priceData) =>
            {
                var resultSeries = new PriceSeries();
                resultSeries.Add((DateTime)priceData.Time, priceData.Last);
                onPriceSeries(priceData.Symbol, resultSeries);
            });

            foreach (var symbol in symbolList)
                PriceServer.Instance.Subscribe(subscriber, symbol);

            var _auto = new ManualResetEventSlim(false);
            _auto.Wait(cancellationToken);

            _log.Debug("This doesn't get hit when the second page is loaded");
Azure中的日志:

2019-06-30 03:08:38.970 +00:00 [Information] Microsoft.AspNetCore.Hosting.Internal.WebHost: Request starting HTTP/1.1 GET https://mydomain-qa.azurewebsites.net/api/ChartData/Prices_LastCloseAndRealtime?symbols=4Q%20Rotate,FANG,AADR,AAWW,ACIM,ACIW,ACSG,ACWF,AAME,ABB,ABC,ABEV,ABM,ABUS
2019-06-30 03:08:38.971 +00:00 [Information] Microsoft.AspNetCore.Routing.EndpointMiddleware: Executing endpoint 'mydomain.Controllers.ChartDataController.Prices_LastCloseAndRealtime (mydomain)'
2019-06-30 03:08:38.972 +00:00 [Information] Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker: Route matched with {action = "Prices_LastCloseAndRealtime", controller = "ChartData"}. Executing controller action with signature Void Prices_LastCloseAndRealtime(System.Threading.CancellationToken, System.String, System.String) on controller mydomain.Controllers.ChartDataController(mydomain).
2019-06-30 03:08:38.978 +00:00 [Information] Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker: Executing action method mydomain.Controllers.ChartDataController.Prices_LastCloseAndRealtime(mydomain) - Validation state: Valid
2019-06-30 03:08:38.978 +00:00 [Information] mydomain.Controllers.ChartDataController: Prices_LastCloseAndRealtime Starting

*** The above lines are from the first request ***

2019-06-30 03:08:51.441 +00:00 [Information] Microsoft.AspNetCore.Hosting.Internal.WebHost: Request starting HTTP/1.1 GET https://mydomain-qa.azurewebsites.net/api/ChartData/EquityCurve_Daily_WithRealtimeUpdates?tradingAccountId=1
2019-06-30 03:08:51.441 +00:00 [Information] Microsoft.AspNetCore.Routing.EndpointMiddleware: Executing endpoint 'mydomain.Controllers.ChartDataController.EquityCurve_Daily_WithRealtimeUpdates (mydomain)'
2019-06-30 03:08:51.441 +00:00 [Information] Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker: Route matched with {action = "EquityCurve_Daily_WithRealtimeUpdates", controller = "ChartData"}. Executing controller action with signature Void EquityCurve_Daily_WithRealtimeUpdates(System.Threading.CancellationToken, Int64, System.String) on controller mydomain.Controllers.ChartDataController(mydomain).
2019-06-30 03:08:51.442 +00:00 [Information] Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker: Executing action method mydomain.Controllers.ChartDataController.EquityCurve_Daily_WithRealtimeUpdates(mydomain) - Validation state: Valid
2019-06-30 03:08:51.442 +00:00 [Information] mydomain.Controllers.ChartDataController: EquityCurve_Daily_WithRealtimeUpdates Starting
2019-06-30 03:08:51.448 +00:00 [Information] Microsoft.EntityFrameworkCore.Infrastructure: Entity Framework Core 2.2.4-servicing-10062 initialized 'ApplicationDbContext' using provider 'Microsoft.EntityFrameworkCore.SqlServer' with options: None
2019-06-30 03:08:51.466 +00:00 [Information] Microsoft.EntityFrameworkCore.Database.Command: Executed DbCommand(15ms) [Parameters=[@__get_Item_0='?' (DbType = Int64)], CommandType='Text', CommandTimeout='30']SELECT TOP(1) [e].[TradingAccountId], [e].[AccountNumber], [e].[AccountTitle], [e].[BrokerId], [e].[CreatedBy], [e].[CreatedDate], [e].[EquityCurveId], [e].[FirstBrokerInfoDate], [e].[FirstFundedDate], [e].[InitialAccountValue], [e].[MostRecent_BODDailyValuesId], [e].[StartDate], [e].[UpdatedBy], [e].[UpdatedDate], [e].[UserId] FROM[TradingAccount] AS[e]WHERE[e].[TradingAccountId] = @__get_Item_0
2019-06-30 03:08:51.469 +00:00 [Information] Microsoft.EntityFrameworkCore.Database.Command: Executed DbCommand(1ms) [Parameters=[@__tradingAccountId_0='?' (DbType = Int64)], CommandType='Text', CommandTimeout='30']SELECT[p].[PositionId], [p].[CreatedBy], [p].[CreatedDate], [p].[DesiredQuantity], [p].[Entry_Commission], [p].[Entry_OrderId], [p].[Entry_Price], [p].[Entry_Time], [p].[Exit_Commission], [p].[Exit_OrderId], [p].[Exit_Price], [p].[Exit_Time], [p].[Quantity], [p].[SmartCardId], [p].[Symbol], [p].[TradingAccountId], [p].[UpdatedBy], [p].[UpdatedDate] FROM[Position] AS[p]WHERE[p].[TradingAccountId] = @__tradingAccountId_0
2019-06-30 03:08:51.485 +00:00 [Information] Microsoft.EntityFrameworkCore.Infrastructure: Entity Framework Core 2.2.4-servicing-10062 initialized 'PriceDbContext' using provider 'Microsoft.EntityFrameworkCore.SqlServer' with options: MigrationsAssembly=mydomain
2019-06-30 03:08:51.815 +00:00 [Information] Microsoft.EntityFrameworkCore.Database.Command: Executed DbCommand(220ms) [Parameters=[@__symbol_0='?' (Size = 40)], CommandType='Text', CommandTimeout='30']SELECT[db].[TradeDate], [db].[Close] FROM[DailyBar] AS[db]WHERE[db].[Symbol] = @__symbol_0ORDER BY[db].[TradeDate]

*** The above lines are from the second request (first request just stopped) ***

2019-06-30T03:08:50 PID[5928] Information 06-30 03:08:50 Critical: StopProfiler triggered.
2019-06-30T03:08:50 PID[5928] Information 06-30 03:08:50 Information: Stopping circular monitor and collecting etl snapshot.
2019-06-30 03:08:38.970 +00:00 [Information] Microsoft.AspNetCore.Hosting.Internal.WebHost: Request starting HTTP/1.1 GET https://mydomain-qa.azurewebsites.net/api/ChartData/Prices_LastCloseAndRealtime?symbols=4Q%20Rotate,FANG,AADR,AAWW,ACIM,ACIW,ACSG,ACWF,AAME,ABB,ABC,ABEV,ABM,ABUS
2019-06-30 03:08:38.971 +00:00 [Information] Microsoft.AspNetCore.Routing.EndpointMiddleware: Executing endpoint 'mydomain.Controllers.ChartDataController.Prices_LastCloseAndRealtime (mydomain)'
2019-06-30 03:08:38.972 +00:00 [Information] Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker: Route matched with {action = "Prices_LastCloseAndRealtime", controller = "ChartData"}. Executing controller action with signature Void Prices_LastCloseAndRealtime(System.Threading.CancellationToken, System.String, System.String) on controller mydomain.Controllers.ChartDataController(mydomain).
2019-06-30 03:08:38.978 +00:00 [Information] Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker: Executing action method mydomain.Controllers.ChartDataController.Prices_LastCloseAndRealtime(mydomain) - Validation state: Valid
2019-06-30 03:08:38.978 +00:00 [Information] mydomain.Controllers.ChartDataController: Prices_LastCloseAndRealtime Starting

*** The above lines are from the first request ***

2019-06-30 03:08:51.441 +00:00 [Information] Microsoft.AspNetCore.Hosting.Internal.WebHost: Request starting HTTP/1.1 GET https://mydomain-qa.azurewebsites.net/api/ChartData/EquityCurve_Daily_WithRealtimeUpdates?tradingAccountId=1
2019-06-30 03:08:51.441 +00:00 [Information] Microsoft.AspNetCore.Routing.EndpointMiddleware: Executing endpoint 'mydomain.Controllers.ChartDataController.EquityCurve_Daily_WithRealtimeUpdates (mydomain)'
2019-06-30 03:08:51.441 +00:00 [Information] Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker: Route matched with {action = "EquityCurve_Daily_WithRealtimeUpdates", controller = "ChartData"}. Executing controller action with signature Void EquityCurve_Daily_WithRealtimeUpdates(System.Threading.CancellationToken, Int64, System.String) on controller mydomain.Controllers.ChartDataController(mydomain).
2019-06-30 03:08:51.442 +00:00 [Information] Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker: Executing action method mydomain.Controllers.ChartDataController.EquityCurve_Daily_WithRealtimeUpdates(mydomain) - Validation state: Valid
2019-06-30 03:08:51.442 +00:00 [Information] mydomain.Controllers.ChartDataController: EquityCurve_Daily_WithRealtimeUpdates Starting
2019-06-30 03:08:51.448 +00:00 [Information] Microsoft.EntityFrameworkCore.Infrastructure: Entity Framework Core 2.2.4-servicing-10062 initialized 'ApplicationDbContext' using provider 'Microsoft.EntityFrameworkCore.SqlServer' with options: None
2019-06-30 03:08:51.466 +00:00 [Information] Microsoft.EntityFrameworkCore.Database.Command: Executed DbCommand(15ms) [Parameters=[@__get_Item_0='?' (DbType = Int64)], CommandType='Text', CommandTimeout='30']SELECT TOP(1) [e].[TradingAccountId], [e].[AccountNumber], [e].[AccountTitle], [e].[BrokerId], [e].[CreatedBy], [e].[CreatedDate], [e].[EquityCurveId], [e].[FirstBrokerInfoDate], [e].[FirstFundedDate], [e].[InitialAccountValue], [e].[MostRecent_BODDailyValuesId], [e].[StartDate], [e].[UpdatedBy], [e].[UpdatedDate], [e].[UserId] FROM[TradingAccount] AS[e]WHERE[e].[TradingAccountId] = @__get_Item_0
2019-06-30 03:08:51.469 +00:00 [Information] Microsoft.EntityFrameworkCore.Database.Command: Executed DbCommand(1ms) [Parameters=[@__tradingAccountId_0='?' (DbType = Int64)], CommandType='Text', CommandTimeout='30']SELECT[p].[PositionId], [p].[CreatedBy], [p].[CreatedDate], [p].[DesiredQuantity], [p].[Entry_Commission], [p].[Entry_OrderId], [p].[Entry_Price], [p].[Entry_Time], [p].[Exit_Commission], [p].[Exit_OrderId], [p].[Exit_Price], [p].[Exit_Time], [p].[Quantity], [p].[SmartCardId], [p].[Symbol], [p].[TradingAccountId], [p].[UpdatedBy], [p].[UpdatedDate] FROM[Position] AS[p]WHERE[p].[TradingAccountId] = @__tradingAccountId_0
2019-06-30 03:08:51.485 +00:00 [Information] Microsoft.EntityFrameworkCore.Infrastructure: Entity Framework Core 2.2.4-servicing-10062 initialized 'PriceDbContext' using provider 'Microsoft.EntityFrameworkCore.SqlServer' with options: MigrationsAssembly=mydomain
2019-06-30 03:08:51.815 +00:00 [Information] Microsoft.EntityFrameworkCore.Database.Command: Executed DbCommand(220ms) [Parameters=[@__symbol_0='?' (Size = 40)], CommandType='Text', CommandTimeout='30']SELECT[db].[TradeDate], [db].[Close] FROM[DailyBar] AS[db]WHERE[db].[Symbol] = @__symbol_0ORDER BY[db].[TradeDate]

*** The above lines are from the second request (first request just stopped) ***

2019-06-30T03:08:50 PID[5928] Information 06-30 03:08:50 Critical: StopProfiler triggered.
2019-06-30T03:08:50 PID[5928] Information 06-30 03:08:50 Information: Stopping circular monitor and collecting etl snapshot.