使用时"Could not get any response"邮递员。包括()



我在MVC控制器的HttpGet方法中有这样的语句:

IEnumerable<UserExtension> iue = await DataContext.UserExtensions;

如果我将命令更改为:

IEnumerable<UserExtension> iue = DataContext.UserExtensions.Include(ue => ue.UserRoles)

代码中没有抛出异常,但我在 Postman 中得到以下响应:

Could not get any response
There was an error connecting to http://localhost:60891/table/UserExtension.
Why this might have happened:
The server couldn't send a response:
Ensure that the backend is working properly
Self-signed SSL certificates are being blocked:
Fix this by turning off 'SSL certificate verification' in Settings > General
Proxy configured incorrectly
Ensure that proxy is configured correctly in Settings > Proxy
Request timeout:
Change request timeout in Settings > General

知道为什么会这样吗?

如果没有.Include()子句,一切正常,并且UserRoles按预期返回为 NULL。

你确定没有例外吗?这听起来像是一个尝试/捕获块"吞噬"了异常。 您可以尝试调试应用程序以了解发生了什么?

数据中的某些内容可能与您的模型不一致。 例如,代码中的 1-1 关系在数据库中具有 1-n 项。

发布检索数据的代码可以帮助我们找出问题所在。

最新更新