用于寻址在唯一标识符中包含句点的条目的 OData URI 约定?
我在应用程序中使用 OData 作为 api。我的一个数据库表有一个包含句点 (.) 的唯一 ID,我尝试使用以下约定访问该表中的条目:
http://foo.bar.com/services/v001.svc/Categories('ABC')
..但我不断收到以下错误:
路径“/services/v001.svc/Categories('ABC')”的控制器未找到或未实现 IController。
我最初认为这是由于我的路线配置错误造成的,但我删除了所有自定义路线,但仍然遇到相同的错误。通过相同的 uri 约定访问我的数据库中所有表中的所有其他条目效果很好。这些条目与所有其他条目之间的唯一区别是我在唯一标识符列中使用了句点。
帮助!
I am using OData as an api within an app. One of my database tables has a unique id that contains periods (.) I'm trying to access the entries in that table using the the following convention:
http://foo.bar.com/services/v001.svc/Categories('A.B.C')
..but I'm continually receiving the following error:
The controller for path '/services/v001.svc/Categories('A.B.C')' was not found or does not implement IController.
I initially thought this was due to a mis-configuration in my routes but I removed all custom routes and still get the same error. Accessing all other entries in all tables within my database via the same uri convention works just fine. The only difference between these entries and all others is that I use a period in the unique identifier column.
Help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题是 Cassini(Visual Studio 中的开发 Web 服务器)在处理 URL 中的句点时存在问题。解决方案是更改项目的属性以使用本地 IIS Web 服务器而不是使用 Cassini。为此:
当然,这假设您的 PC 上安装了 IIS。为什么 Cassini 不喜欢句点而完整的 IIS 喜欢?谁知道?
The probelm is that Cassini (the development web server within Visual Studio) has a problem handling periods in a URL. The solution is to change the project's properties to use a Local IIS Web Server instead of using Cassini. To do this:
This of course assumes you have IIS installed on your PC. Why Cassini doesn't like periods and full IIS does? Who knows?