在向我的学生解释 ASP.NET MVC 的概念时
MVC is stateless. It is built on top of another stateless protocol - HTTP and HTTPS
但一位学生打断并问道,
You tell that the MVC is stateless
Stateless protocol never cares if the response comes back or not from the server. But, in ASP.NET MVC framework, you make a request and wait for the response. Since you wait for the response, it should be called as a stateful service. How come you are calling it a stateless service then?
我真的很困惑,想知道如何回答这个问题。
有什么想法吗?
最佳答案
MVC 不是无状态的,HTTP 是。
HTTP 是无状态的并不意味着它是一劳永逸的。客户端确实等待响应。它是无状态的,因为两个连续的请求没有任何关系。
可以使用 session 模拟状态,例如使用 cookie。
关于c# - 为什么 MVC 是无状态的——如何解释?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23470065/