Tag: asynccontroller

异步操作完成,但结果不会发送到浏览器

我想实现网络聊天。 后端是双WCF通道。 双通道可在控制台或winforms中运行,它实际上可在Web上运行。 我至少可以发送和接收消息。 作为基础,我使用了这篇博文 ,异步操作就完成了。 当我调试结果时,我看到消息都已准备好发送到浏览器。 [AsyncTimeout(ChatServer.MaxWaitSeconds * 1020)] // timeout is a bit longer than the internal wait public void IndexAsync() { ChatSession chatSession = this.GetChatSession(); if (chatSession != null) { this.AsyncManager.OutstandingOperations.Increment(); try { chatSession.CheckForMessagesAsync(msgs => { this.AsyncManager.Parameters[“response”] = new ChatResponse { Messages = msgs }; this.AsyncManager.OutstandingOperations.Decrement(); }); } catch (Exception ex) { […]