启动时出现OData v4错误:找不到段"Whatever"的资源 [英] OData v4 error on start-up: Resource not found for the segment 'Whatever'
问题描述
我正在构建新的v4服务,直到我为新的模型/实体添加新的控制器并在启动网站进行测试运行时出现此错误为止,一切进展顺利.
I am building out my new v4 service and all was going well until I added a new controller for a new model/entity and got this error when starting the site up for a test run.
与其他控制器一样,控制器似乎已正确编码.
The controller seems to be correctly coded, just like the others.
控制器"CustomersOData"中操作"GetFeed"上的路径模板"Customers"不是有效的OData路径模板.找不到客户"细分的资源.
The path template 'Customers' on the action 'GetFeed' in controller 'CustomersOData' is not a valid OData path template. Resource not found for the segment 'Customers'.
这是什么意思?
推荐答案
如果在启动时发生这种情况,请检查是否在启动过程中将客户"模型类型添加到了模型构建器中.
If this is happening on start-up then check that you have added your Customers model type to the model builder during start-up.
builder.EntitySet<CustomerModel>("Customers");
听起来好像正在为新控制器枚举属性映射,但是它无法将Customer模型类型映射回实体集.
It sounds like the attribute mappings are being enumerated for the new controller but it cannot map the Customer model type back to an entity set.
注意:问/答:我几乎立即想出了这个问题,但我在这里发布是因为我可能会再次这样做,而忘记我做错了什么!
Note: Q/A I figured this out almost immediately but I'm posting here because I'll probably do this again and forget what I did wrong!
这篇关于启动时出现OData v4错误:找不到段"Whatever"的资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!