John Antony
John Antony

Reputation: 61

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.

Upvotes: 6

Views: 15790

Answers (3)

Wassim Mohamed
Wassim Mohamed

Reputation: 1

If nothing worked, try to make Platform Target to be Any CPU Uncheck Prefer 32-Bit Check Allow Unsafe Code

The above solution wored for me.

Upvotes: 0

Richie
Richie

Reputation: 91

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>

Upvotes: 9

Tracy G
Tracy G

Reputation: 21

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.

Upvotes: 1

Related Questions