Joh*_*ony 5 .net c# asp.net dll geospatial
我正在做一个项目,它有一些关于地理距离计算的功能。所以我通过SqlServerSpatial110.dll为该函数添加 nuget 包在实体框架中使用地理数据类型。
我认为我的代码是正确的。一切都在本地服务器上工作。但是当我将它上传到服务器时,它显示以下错误:
System.Reflection.TargetInvocationException:调用的目标已抛出异常。---> System.DllNotFoundException: 无法加载 DLL 'SqlServerSpatial110.dll': 找不到指定的模块。(来自 HRESULT 的异常:0x8007007E)
请告诉我上传SqlServerSpatial110.dll到服务器的步骤。
小智 7
在应用程序的 Web.config 中添加 Microsoft.SqlServer.Types 的引用解决了该问题。
<runtime><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.SqlServer.Types" publicKeyToken="89845dcd8080cc91" />
<bindingRedirect oldVersion="1.0.0.0-11.0.0.0" newVersion="10.0.0.0" />
</dependentAssembly>
</assemblyBinding></runtime>
Run Code Online (Sandbox Code Playgroud)
小智 1
请检查以确保 DLL 已安装在服务器上:
C:\Program Files (x86)\Microsoft SQL Server\110\SDK\Assemblies\Microsoft.SqlServer.Types.dll
C:\Windows\System32\SqlServerSpatial110.dll
Run Code Online (Sandbox Code Playgroud)
请检查您的应用程序池。如果您重新使用旧的 AppPool,请确保您的 AppPool Advanced Settings-->Enable 32-Bit Applications是False。
这解决了我在Windows 2012 Server.