【问题标题】:Error after deploy to Azure: "The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect."部署到 Azure 后出错:“传入的表格数据流 (TDS) 远程过程调用 (RPC) 协议流不正确。”
【发布时间】: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 的空间。

【问题讨论】:

标签: sql-server azure asp.net-core nettopologysuite


【解决方案1】:

我终于改变了:

Convert.ToDouble(longitude.Replace(".", ","))

Convert.ToDouble(longitude, CultureInfo.InvariantCulture)

现在它可以在本地和 Azure 上运行。

受此启发的解决方案:string to double issue, dot is removed

【讨论】:

    猜你喜欢
    • 2018-05-01
    • 1970-01-01
    • 2018-10-24
    • 1970-01-01
    • 1970-01-01
    • 2013-06-02
    • 1970-01-01
    • 1970-01-01
    • 2020-05-26
    相关资源
    最近更新 更多