2つの配置スロットを持つAzureにWebアプリケーションがあります。 1つのスロットは開発用です。もう一方のスロットは生産用です。Azureの生産スロットでSignalRが断続的に停止する
私は自分のコントローラの1つにSignalRハブ(自己ホスト型)を作りました。基本的には、このコントローラーはAzure DBにレコードを記録する役割を担っています。特に、このコントローラは、ユーザーが特定のリンクを開いて電子メールおよび/またはクリックするタイミングを制御するために使用されます。
SignalRハブは、すべての「接続されたユーザー」にプッシュ通知を送信するのを容易にするために使用されます。
開発スロットでこれをテストすると、すべてが期待どおりに機能します。
しかし、私は自分のプロダクションスロットにスワップするとすぐに、奇妙な行動が起こり始める。いくつかの通知が来る。いくつかは(基本的にクライアントに達することはありません)。通知が遅れることがあります。
今、この問題の解決方法はわかりません。私のコードにバグがあるかどうか(または私が根本的に間違っていることをしているかどうか)はわかりません。
私はこのことが間欠的に停止する理由についていくつかの助けが必要です。または単に動作していないようです。
私はWebSocketも両方の展開スロットに対応しています。
また、コンシューマはWinFormクライアントです。
Iは実際のメッセージ(各ConnectionIDにプッシュ通知)をダウン送信してい今どここれは:
AddToTblEmailEventDB(SentEmail, true, strEventOpen, strRecipientCookie);
//Save is done in this function
string strBody = Helper.HtmlHelper.OpenJsonSerializer(SentEmail);
List<string> lstConnectionIDsToSendTo = new List<string>();
if (UserHandler.ConnectedUsers != null)
{
for (int i = 0; i < UserHandler.ConnectedUsers.Count; i++)
{
if (UserHandler.ConnectedUsers.ElementAt(i).EmailAddress == SentEmail.tbl1Merges.AspNetUser.Email.ToString())
{
lstConnectionIDsToSendTo.Add(UserHandler.ConnectedUsers.ElementAt(i).ConnectionID);
}
}
}
//Actual Sending down happens here below....
if (lstConnectionIDsToSendTo.Count > 0)
{
for (int i = 0; i < lstConnectionIDsToSendTo.Count; i++)
{
//Start sending the messages down to the devices
hubContext.Clients.Client(lstConnectionIDsToSendTo.ElementAt(i)).updateMessages(strBody);
}
}
さて、これは基本的に(JSON形式である)メッセージを消費するコードでありますクライアント:
HubProxy.On(Of String)("updateMessages", Sub(message)
Me.Invoke(DirectCast(
Sub()
If DateTime.Now < dtmHideNotification Then
Exit Sub
End If
strJSONData = message
'Display
If strJSONData <> String.Empty Then
strJSONData = "[" & strJSONData & "]"
strJSONData = strJSONData.Replace(JSON_QUOTE, """") '"
dvNotifications = GetNotifications(strJSONData)
If dvNotifications IsNot Nothing Then
strSubject = dvNotifications(0).Item("Subject")
strType = Trim(dvNotifications(0).Item("Type"))
strDateTime = (dvNotifications(0).Item("Date"))
strRecipient = dvNotifications(0).Item("Recipients")
strEmailSendID = Trim(dvNotifications(0).Item("EmailSendID"))
If dvNotifications.Table.Columns("LinkClicked") IsNot Nothing Then
strLinkClicked = CStr(dvNotifications(0).Item("LinkClicked"))
Else
strLinkClicked = String.Empty
End If
If CInt(strRecipient) = 1 Then
strRecipient = dvNotifications(0).Item("EmailAddress")
Else
'strRecipient = "Someone"
'Dutt 7/12/15 Instead of someone , displaying "RecipientName or .."
strRecipient = dvNotifications(0).Item("EmailAddress") & " or..."
End If
If (strLinkClicked.Length > 20) Then
strLinkClicked = strLinkClicked.Substring(0, 20) & "..."
End If
Select Case strType
Case "O"
strType = "Opened"
Case "C"
strType = "Clicked"
Case "M"
Exit Sub 'If there is a Merge taking place, then need to skip this iteration of the loop (because we don't want to show it)
Case Else
'Do nothing Keep as same
End Select
Dim CustomNotification As New CustomNotification
CustomNotification.TopMost = False
CustomNotification.lblSubject.Text = IIf(strSubject = String.Empty, "[No Subject]", strSubject)
CustomNotification.EmailSendID = strEmailSendID
CustomNotification.pctIcon.Visible = True
CustomNotification.UserName = GetUserEmail()
CustomNotification.Password = GetUserPassword()
If strType <> String.Empty Then
If Trim(strType) = "Opened" Then
CustomNotification.pctBox.Image = My.Resources.glyphicons_52_eye_open
CustomNotification.lblContent.Text = strRecipient & " has " & strType.ToLower() & " this " & strDateTime
End If
If Trim(strType) = "Clicked" Then
CustomNotification.pctBox.Image = My.Resources.glyphicons_51_link
CustomNotification.lblContent.Text = strRecipient & " has clicked on" & " " & strLinkClicked & " " & strDateTime
End If
End If
CustomNotification.ShowDialog()
If CustomNotification.CloseTemporarily Then
If CustomNotification.CloseTemporarily Then
'Hide the form
CustomNotification.Close()
dtmHideNotification = DateTime.Now.AddMinutes(2)
Exit Sub
End If
End If
'Next
End If
End If
End Sub, Action))
End Sub)
WinFormコンシューマはVB.NETフォームであることに注意してください。それがハブに接続するだけで、いずれかのメッセージが送信されるまで待ちます。
どこが間違っているのかわかりません!
私は過去に前にこのARRの親和性の問題に遭遇していません。しかし、私は今それを試してみましょう。 –
ブラウザからARRAffinityクッキーを削除し、両方の展開でARR Affinityを無効にしてから、テストしてください。 – Guy
ちょうど開発スロットでこれをテストしています....私は今すぐプッシュしているようです....あまり確かではありません。後でスワップして確認します。 –