2016-08-19 3 views
1

Windows 10 운영체제가 있고 Chrome, Firefox 및 Internet Explorer 브라우저가 설치되어 있습니다. 나는 asp.net MVC에서 SignalR 알림 시스템으로 응용 프로그램을 만들려고합니다. Firefox에서 응용 프로그램을 실행할 때 모든 것이 정상적으로 작동합니다. 그러나 Internet Explorer 및 Google 크롬에서는 작동하지 않습니다.Chrome 및 Internet Explorer에서 SignalR이 작동하지 않습니다.

private void sqlDep_OnChange(object sender, SqlNotificationEventArgs e) 
    { 
     if(e.Type == SqlNotificationType.Change) 
     { 
      SqlDependency sqlDep = sender as SqlDependency; 
      sqlDep.OnChange -= sqlDep_OnChange; 

      var notificationHub = GlobalHost.ConnectionManager.GetHubContext<NotificationHub>(); 
      notificationHub.Clients.All.notify("added"); 
      DateTime dt = DateTime.Now; 
      DateTime dt1 = DateTime.UtcNow.AddHours(2); 

      RegisterNotification(dt); 
     } 
    } 

그러나

notificationHub.Clients.All.notify("added"); 

자바 스크립트에 도달 할 때 다음되는 : debbuging 때 내가 무엇을 발견 내 데이터베이스에 변경이 이루어질 때, 응용 프로그램이 방법에 따라 제대로 실행 않는다는 것입니다

  notificationHub.client.notify = function (message) { 
      if (message && message.toLowerCase() == "added") { 
       updateNotificationCount(); 
      } 
     } 

반응하지 않습니다. Firefox에서는 반응합니다.

이 문제를 해결할 수 있도록 도와 주시겠습니까?

+0

코드가 Chrome 및 IE에서 허브 연결을하지 못하는 것 같습니다. 실패한 브라우저에서 콘솔을 검사하여 오류가 기록되어 있는지 확인할 가치가 있습니다. – Luke

+0

고맙습니다.하지만 작동하는 것 같습니다. – hegendroffer

+0

오류가 있습니까? :) – Luke

답변

1

나는이 문제를 해결했다. 내가 내 NotificationHub 클래스에 한 줄을 추가했다 밝혀졌다 :

[HubName("notificationHub")] 

지금은 다음과 같은 모양이 내 문제를 해결했다.

[HubName("notificationHub")] 
public class NotificationHub : Hub 
{ 
    //public void Hello() 
    //{ 
    // Clients.All.hello(); 
    //} 
} 
관련 문제