为什么此 URI 会在 OData 服务中产生运行时错误?

Why is this URI producing a runtime error in the OData service?

以下 URI 在 public OData 服务中触发了一个错误:

http://services.odata.org/V4/Northwind/Northwind.svc/Suppliers?$filter=Address eq '<A'

实体类型 供应商 包含 属性 地址 类型 Edm.String.因此,Address 的值可能包含定义中的任何 UTF-8 字符(参见 6. Primitive data types 部分)。

服务器响应:

Runtime Error: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons).

这个 URI 是否有问题,或者它确实是服务器端的问题(例如,$filter 查询选项的解析不当)?

您应该对您的查询进行编码 URL,例如在

的帮助下

http://prasannaadavi.com/2014/06/handling-special-characters-in-odata-queries.html

How are special characters handled in an oData query?

在您的特殊情况下,您应该尝试使用 "&lt;A"

编码 "<A"

--> 在 https://web.archive.org/web/20150101222238/http://msdn.microsoft.com/en-us/library/aa226544(SQL.80).aspx)

中找到