2017-12-17 3 views
2

Ich arbeite mit Angular 5.1.1 und @angular/cli ^1.6.1.
Ich möchte Asp.Net Core SignalR verwenden.
So habe ich die folgende Proxy-Einstellung:Angular 5.1.1 unendliche Refresh-Schleife nach Proxy für Signalr festgelegt?

const PROXY_CONFIG = [ 
    { 
    context: [ 
     "/api", 
     "/Temp", 
     "/Upload", 
     "/notificationHub", 
     "/sockjs-node" 
    ], 
    target: "http://localhost:52918/", 
    changeOrigin: true, 
    secure: false, 
    logLevel: 'debug', 
    ws: true 
    } 
]; 

module.exports = PROXY_CONFIG; 

Ich beginne Projekt mit ng serve --proxy-config proxy.config.js Befehl
Aber auf http://localhost:4200/ kommt, erhalte ich die folgende Meldung in der Befehlszeile und Aktualisierung der Seite und diese Wiederholung bis unendlich

[HPM] POST /api/Category/GetAll/ -> http://localhost:52918/ 
[HPM] POST /api/Product/GetAllActives/ -> http://localhost:52918/ 
[HPM] OPTIONS /notificationHub -> http://localhost:52918/ 
[HPM] GET /notificationHub?id=dedf5495-4438-4a9a-9742-d4b16fe0c94b -> http://localhost:52918/ 
[HPM] Upgrading to WebSocket 
[HPM] GET /sockjs-node/505/k1gctvfq/websocket -> http://localhost:52918/ 
[HPM] Upgrading to WebSocket 
[HPM] GET /sockjs-node/156/bsye5nne/websocket -> http://localhost:52918/ 
[HPM] Upgrading to WebSocket 
[HPM] Client disconnected 
[HPM] POST /api/Category/GetAll/ -> http://localhost:52918/ 
[HPM] POST /api/Product/GetAllActives/ -> http://localhost:52918/ 
[HPM] OPTIONS /notificationHub -> http://localhost:52918/ 
[HPM] GET /notificationHub?id=afc731c5-98ba-450a-84b3-f023e7770b37 -> http://localhost:52918/ 
[HPM] Upgrading to WebSocket 
[HPM] GET /sockjs-node/627/d0yup2yn/websocket -> http://localhost:52918/ 
[HPM] Upgrading to WebSocket 
[HPM] GET /sockjs-node/069/y3cwf4bi/websocket -> http://localhost:52918/ 
[HPM] Upgrading to WebSocket 
[HPM] Client disconnected 

infinite refresh loop, angular cli

Wie können wir unendlich refresh Schleife stoppen?

Antwort

1

Endlich konnte ich die Lösung finden
Ich habe Proxy-Konfiguration wie folgt zu ändern:

const PROXY_CONFIG = [ 
    { 
    context: [ 
     "/api", 
     "/Temp", 
     "/Upload", 
     "/notificationHub" 
    ], 
    target: "http://localhost:52918/", 
    secure: false, 
    logLevel: 'debug', 
    ws: true 
    } 
]; 

Es ist OK, jetzt

Verwandte Themen