【发布时间】:2020-06-22 19:29:03
【问题描述】:
我正在使用 Visual Studio 2019 在 .NET Core 3.1 中开发应用程序,并且在装有 Windows 10 Pro 的本地计算机上一切正常。但是部署到 Azure 后会出现这个问题:
The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Parameter 9 ("@p8"): The supplied value is not a valid instance of data type geography. Check the source data for invalid values. An example of an invalid value is data of numeric type with scale greater than precision
将 Post 添加到数据库时会出现此错误。 Post 具有 NetTopologySuite.Geometries.Point 类型的属性,设置如下:
location = new Point(longitude, latitude) { SRID = 4326 }; 经度和纬度是双倍的。
当我将位置设置为 null 时,不会出现错误。 我尝试使用较低的精度,例如点前 2 位和点后 6 位 - 这仍然会导致错误。
我使用实体框架核心。它生成 db 列为Location (geography, null)。
编辑:
我正在将 lat 和 lon 字符串转换为这样的两倍:Convert.ToDouble(longitude.Replace(".", ","))。我删除了.Replace(".", ","),现在它可以在 Azure 上运行,但同样的错误出现在本地环境中。
我在两个数据库上都有 id 4326 的空间。
【问题讨论】:
-
你好,其他的也有同样的错误,已经解决了。请参考:stackoverflow.com/questions/59493887/… 和 github.com/dotnet/efcore/issues/19416。
-
问题是别的。 azure db中有空间4326。
标签: sql-server azure asp.net-core nettopologysuite