Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

System.DllNotFoundException: Unable to load DLL 'SqlServerSpatial110.dll': The specified module could not be found

I am doing a project which having some functions on Geographical distance calculation. So I use geographical datatypes in entity framework by adding nuget package SqlServerSpatial110.dll for that function.

I think my code is correct. Everything is working on local server. But when I uploaded it to server it shows the error below:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.DllNotFoundException: Unable to load DLL 'SqlServerSpatial110.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

please tell me the steps to upload SqlServerSpatial110.dll to server.

like image 892
John Antony Avatar asked Jan 30 '15 16:01

John Antony


2 Answers

Add the reference of Microsoft.SqlServer.Types in Web.config of application resolved the issue.

<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>
like image 180
Richie Avatar answered Sep 22 '22 06:09

Richie


Please check to make sure the DLLs are installed on the server:

C:\Program Files (x86)\Microsoft SQL Server\110\SDK\Assemblies\Microsoft.SqlServer.Types.dll
C:\Windows\System32\SqlServerSpatial110.dll

Please check your AppPool. If you are re-using an old AppPool, make sure your AppPool Advanced Settings --> Enable 32-Bit Applications is False.

This fixed my similar problem on a Windows 2012 Server.

like image 44
Tracy G Avatar answered Sep 23 '22 06:09

Tracy G