entity-framework - Azure 函数和空间类型以及程序集 'Microsoft.SqlServer.Types'

标签 entity-framework azure azure-functions

获得一个 Azure 函数,该函数应该调用上下文来更新 DbGeography 的值。我不断收到此异常:

Spatial types and functions are not available for this provider because the assembly 'Microsoft.SqlServer.Types' version 10 or higher could not be found.

我在 Azure Function 项目中安装了 NuGet 包。目前,Azure Function 尚未发布,我在本地运行它。即使部署了该功能,解决这些问题也是很好的。

最佳答案

根据您的错误消息,我认为您的问题与您尝试部署到未安装 SQL Server 的 CLR 类型的计算机有关。

您说您已经安装了 Nuget 包,因此我建议您还可以检查 native SqlServerSpatial110.dll 程序集的适当版本是否已复制到输出目录并与您的应用程序一起部署。有关此问题的更多详细信息,您可以引用此article .

您还可以检查是否安装了 Microsoft System CLR Types。欲了解更多详情,您可以阅读此SO thread .

After a lot of research I just installed "Microsoft System CLR Types for SQL Server 2012" from:

X86 - http://go.microsoft.com/fwlink/?LinkID=239643&clcid=0x409

X64 - http://go.microsoft.com/fwlink/?LinkID=239644&clcid=0x409

Worked like a charm!

此外,如果我在 Microsoft.SqlServer.Types 包中使用 SqlGeography,它在我这边工作得很好:

Azure函数中的代码:

enter image description here

Azure 门户中的结果:

enter image description here

关于entity-framework - Azure 函数和空间类型以及程序集 'Microsoft.SqlServer.Types',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49798239/

相关文章:

java - Java 的全栈框架

c# - .Net 实体多对多 SaveChanges

python - sas生成的blob url向azure ocr api发送错误请求400

java - 无法在 Azure Web 应用上运行 Solr

c# - Azure Functions DbContext 请求延迟 - 在启动时连接到数据库?

c# - Entity Framework 中数据类型不匹配时的导航属性

linq - EF如何按日期过滤数据

Azure:从 MySQL 数据库创建 O365 事件

c# - Azure Functions - 使用 appsettings.json

node.js - Azure 函数应用程序 (v4/node.js) zip 部署后找不到函数