【发布时间】:2020-02-16 18:34:19
【问题描述】:
我正在使用 Signal-R 编写一个 Web API 核心项目。有一个 hub 为每个请求生成一个连接 ID:
public class TargetHub : Hub<ITargetLogger>
{
public string GetConnectionId()
{
return Context.ConnectionId;
}
}
我在我的 UI 端使用 Angular 7,并且我正在使用这段代码来创建一个新请求:
GetConnection() {
this.projectHandle = Guid.newGuid();
let connection: signalR.HubConnection;
let accessToken = "3076a225-f2f6-4c68-b894-08accb62bb90";
connection = new signalR.HubConnectionBuilder().withUrl("http://localhost:200/targetHub", { accessTokenFactory: () => accessToken }).build();
this.currentConnection = connection;
connection.start().then(() => {
connection.invoke("GetConnectionId")
.then((connectionId) => { this.currentConnectionId = connectionId; })
}).catch(err => console.error(err));
}
当我在IIS Express 上调试和测试项目时,效果很好。我可以创建任意数量的请求。
但是当我在主IIS 上发布它时,我只能创建 10 个请求。这个限制是什么以及如何避免和修复它?
【问题讨论】:
-
@mjwills 我刚刚编辑了我的最后一行。发布项目后会出现问题。
-
如果同时在 Chrome、IE 11、Firefox 和 Edge 中打开应用程序,它们是否都会分别收到 10 个请求?总共?还有什么?
-
@mjwills 我总共可以在所有浏览器中发送 10 个请求。例如 IE 中的 3 个,FireFox 中的 4 个和 Chrome 中的 3 个。仅此而已。
-
Windows 10?你可以试试 Windows Server 2016/2019。
标签: c# angular iis asp.net-web-api signalr