2016-10-11 4 views
0

에서 작동 나는 다음과 같은 자바 스크립트 라이브러리가 : 내가 가서 자바 스크립트에서SignalR 내 SignalR 클라이언트에서 localhost 만

<!--Reference the jQuery library. --> 
<script src="Scripts/jquery-1.6.4.min.js"></script> 
<!--Reference the SignalR library. --> 
<script src="Scripts/jquery.signalR-2.2.1.min.js"></script> 
<!--Reference the autogenerated SignalR hub script. --> 
<script src="http://localhost:8081/signalr/hubs"></script> 

:

$.connection.hub.url = "http://localhost:8081/signalr; 
$.connection.hub.logging = true; 
var push = $.connection.exosChangeNotifier; 
... 
$.connection.hub.start().done(); 

연결이 로컬 호스트와 함께 잘 작동합니다. 내가 VM 또는 다른 컴퓨터에 내 SignalR 허브를 실행하고 IP 주소 나 컴퓨터 이름으로 로컬 호스트를 교체 할 때, 나는 얻을

http://[servername]:8081/signalr/hubs Failed to load resource: the server responded with a status of 400 (Bad Request) 
Uncaught TypeError: Cannot read property 'client' of undefined. 

나는 등 내 컴퓨터에 방화벽에서 포트 8081을 열어 나가는 규칙 및 원격 컴퓨터 또는 VM에 대한 규칙을 정의합니다. Sysinternal psping으로 I 포트에 도달 할 수 있는지 확인 :

psping.exe [servername]:8081 -h 

을 내가 컴퓨터를 다시 한 번 확인 할 수 있던 Powershell Script으로하는 것은 도달하고 포트가 열려 있습니다. 셀프 호스팅 SignalR 시작 I에

은 CORS가 활성화 :

map.UseCors(CorsOptions.AllowAll); 

나는 무엇을 놓치고?

+0

서버에서도 포트 8081을 사용하고 있습니까? – Ted

+0

예. 8081은 서버와 클라이언트에서 사용됩니다. 그렇지 않으면 로컬에서 사용할 때 작동하지 않습니다. – tobre

+0

그것은 외부에 아무도 당신을 도울 수있는 뭔가 올바른 URL을 알아낼 필요가있는 것 같습니다 ... – Ted

답변

0

용액이 this SO Question 인 것을 발견했다. 서버는 내부 및 외부 요청에 응답하기 위해 http : // * : 8081로 시작해야합니다. localhost를 수신하기 전에 설정되었습니다.