I have a .NET MVC web application referencing System.Data.Spatial
so I can use the DbGeography
datatype on a property for some geolocation stuff. I'm using Visual Studio 2012 with .NET 4.5 and do not have a full installation of SQL Server on my development machine (only localdb).
The app works great until I push it to Azure. As soon as my app hits my DbGeography
property, it throws this error:
Unable to load DLL 'SqlServerSpatial.dll': The specified module could not be found.
Has anyone else encountered this issue?
9条答案
按热度按时间xienkqul1#
SqlServerSpatial.dll is unmanaged code. You have to install the correct version (64bit) on the server. Add the DLL to your project. Set the properties of SqlServerSpatial110.dll to “Copy to Output directory = Copy always”
You find detailed Information here
ubby3x7f2#
SQL 2012 installs this dll too, SQL 2014 don't! You have to install the Microsoft System CLR Types for SQL Server 2008 R2 on the machine.
Check off one of these depending on your processor architecture:
1033\x64\SQLSysClrTypes.msi
1033\x86\SQLSysClrTypes.msi
1033\IA64\SQLSysClrTypes.msi
Click Next
Edit
as
Ian Grainger
's comment, you have to install the correct version based on your IIS. apparently IIS Express runs in 32bit mode by default.6rvt4ljy3#
4ioopgfo4#
I ran into this problem and was truly missing the SqlServerSpatial110.dll
I ended up following the instructions here:
http://dllyes.com/sqlserverspatial110-dll/
Basically you need to get your hands on that .dll and then
Place SqlServerSpatial110.dll in \Windows\System32 (usually located at disk C) if you’re running 32 bit Windows. If you’are running 64 bit Windows, additionally place file in \Windows\SysWOW64.
laximzn55#
I was struggling with it for a quite some time, i installed required files, but it still wasn't working.
Apparently, the project wanted to use x86 SqlServerSpatial.dll So i changed the IIS Express Build to x64 in Tools>Options>WebProjects>Use the 64 bit IIS Here is the screen
There is no need of adding new nuget packages, just install the SQLSysClrTypes from microsoft page : http://go.microsoft.com/fwlink/?LinkID=188391&clcid=0x409 and it should be fine ;)
Hope that it helps someone!
yhived7q6#
Make sure that your dlls(such as "sqlserverspatial110.dll" , "sqlserverspatial120.dll" , ..) be in this path "C:\Windows\SysWOW64";
vcudknz37#
If the files are referenced in the project correctly and added to source control and the issue is still occurring, try installing the Microsoft System CLR Types for SQL Server on the machine it's failing on.
-Install the version matching the SqlServerTypes referenced in the project.
-Install either the 64 bit or 32 bit of SQLSysClrTypes.msi matching what the project is or 'msbuild' platform the compile script is using. This doesn't require the full version of SQL Server to be installed on the machine.
vof42yt18#
SqlGeometry
andSqlGeography
types can be used in VS projects (e.g. C#) by referencing theMicrosoft.SqlServer.Types.dll
.Microsoft.SqlServer.Types.dll
is a managed library and has some unmanaged library as prerequisites and they are likeSqlServerSpatialXXX.dll
andmsvcrXXX.dll
Microsoft.SqlServer.Types.dll
are available, however, I don't see any functionality change from 2012 on.For a detailed solution you may want to see my answer on another similar post.
7hiiyaii9#
I Resolved it by Updating my EF5 to EF6
in package manager console run to EF5 to EF lalest