gpt4 book ai didi

Angular 和 SignalR 抛出 502

转载 作者:行者123 更新时间:2023-12-03 04:24:15 28 4
gpt4 key购买 nike

我已经使用了这个很棒的教程https://blog.sstorie.com/integrating-angular-2-and-signalr-part-2-of-2/以 Angular 实现信号客户端。但是,如果我想从我的网站连接到 Azure 上托管的服务,我会收到此错误

WebSocket connection to 'ws://...' failed: Error during WebSocket handshake: 
Unexpected response code: 502

我的 Azure 应用程序启用了 Websoket,并且我的服务中的 cors 设置为 *

package.json 中我的依赖项:

     "dependencies": {
"@angular/animations": "^4.2.3",
"@angular/common": "^4.2.3",
"@angular/compiler": "^4.2.3",
"@angular/compiler-cli": "^4.2.3",
"@angular/core": "^4.2.3",
"@angular/forms": "^4.2.3",
"@angular/http": "^4.2.3",
"@angular/platform-browser": "^4.2.3",
"@angular/platform-browser-dynamic": "^4.2.3",
"@angular/platform-server": "^4.2.3",
"@angular/router": "^4.2.3",
"@ngx-translate/core": "^7.0.0",
"@ngx-translate/http-loader": "0.1.0",
"admin-lte": "^2.3.11",
"angular2-notifications": "^0.7.4",
"bootstrap": "^3.3.7",
"core-js": "^2.4.1",
"font-awesome": "^4.7.0",
"jquery": "^3.2.1",
"ng2-validation": "^4.2.0",
"rxjs": "^5.4.1",
"signalr": "^2.2.2",
"ts-helpers": "^1.1.2",
"typescript": "2.3.4",
"zone.js": "^0.8.12"
},
"devDependencies": {
"@angular/cli": "^1.1.2",
"@angular/compiler-cli": "^4.2.3",
"@types/jasmine": "2.5.52",
"@types/node": "^6.0.42",
"codelyzer": "~3.0.1",
"jasmine-core": "2.6.4",
"jasmine-spec-reporter": "4.1.0",
"karma": "1.7.0",
"karma-chrome-launcher": "^2.1.1",
"karma-cli": "^1.0.1",
"karma-jasmine": "^1.1.0",
"karma-remap-istanbul": "^0.6.0",
"protractor": "~5.1.2",
"ts-node": "3.0.6",
"tslint": "^5.4.3",
"typescript": "2.3.4"
}

我的 angluar-cli.json 在脚本部分包含此内容:

  "scripts": [
"../node_modules/jquery/dist/jquery.js",
"../node_modules/signalr/jquery.signalr.js",
...
],

最佳答案

添加<httpRuntime targetFramework="4.7" />后到我的 web.config 错误消失了。

关于Angular 和 SignalR 抛出 502,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45269266/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com