Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to load DLL 'SqlServerSpatial140.dll': The specified module could not be found

This all new to me, so bear with me...

I'm working on a Visual Studio project; it's a web service that returns some data.

I've just tried to make a particular call to the web server on my local machine (IIS) and I'm getting this error:

Unable to load DLL 'SqlServerSpatial140.dll': The specified module could not be found

Before anyone says it - yes, obviously I am missing this DLL file. I've searched online and don't see where I could download it from (I have Microsoft SQL Server System CLR Types (x64) and non-X64 both installed. I have Microsoft System CLR Types for SQL Server 2014 and 2016 both installed)

Does anyone know how to fix this? Does anyone know if I can just download this file from somewhere?

like image 361
reviloSlater Avatar asked Mar 07 '17 17:03

reviloSlater


Video Answer


1 Answers

When you install the Microsoft.SqlServer.Types nuget package, this should create a new folder in root:

\SqlServerTypes    |_x64    |_x86 

which should contain the appropriate dll's. It's also auto setup to copy if newer.

Then, make sure your app loads the appropriate assembly:

  • For ASP.NET Web Applications: SqlServerTypes.Utilities.LoadNativeAssemblies(Server.MapPath("~/bin"));
  • For desktop applications / others: SqlServerTypes.Utilities.LoadNativeAssemblies(AppDomain.CurrentDomain.BaseDirectory);

Not sure if this works with .NET Core though.

like image 106
Pure.Krome Avatar answered Oct 02 '22 15:10

Pure.Krome