【发布时间】:2020-12-07 21:05:20
【问题描述】:
这已经被问过很多次了,但是在遵循this answer 中的建议之后,我仍然没能做到。
我有一个被另一个应用程序调用的类库。这在本地工作没有问题。我使用以下...
SqlServerSpatial140 和 msvcr120 都在各自文件夹的 bin 中。
在调用空间调用之前
SqlServerTypes.Utilities.LoadNativeAssemblies(dlls); // dlls == bin directory
SqlProviderServices.SqlServerTypesAssemblyName = typeof(SqlGeography).Assembly.FullName;
App.config
<runtime>
<dependentAssembly>
<assemblyIdentity name="Microsoft.SqlServer.Types" publicKeyToken="89845dcd8080cc91" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-14.0.0.0" newVersion="14.0.0.0" />
</dependentAssembly>
</runtime>
但是,当部署到服务器上时,我在调用 System.Data.Entity.Spatial.DbGeography.FromText(String wellKnownText) 时得到一个 System.InvalidOperationException
有错误
空间类型和函数不适用于此提供程序,因为找不到版本 10 或更高版本的程序集“Microsoft.SqlServer.Types”。 System.InvalidOperationException:空间类型和函数不适用于此提供程序,因为找不到程序集 'Microsoft.SqlServer.Types' 版本 10 或更高版本。
我在这里错过了什么?
【问题讨论】:
-
我有同样的问题,我在服务器上安装了 Sql Server Management Studio,这个问题就消失了。如果您无法安装 SSMS,那么您也可以在服务器上安装 Sql Server Developer Tools。试试这个,让我知道它是否有效,我会发布这个评论作为答案。
标签: c#