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

3

6

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.

Jakie answered 30/1, 2015 at 16:37 Comment(3)
Is you DLL's CopytoOutputDirectory set to CopyAlways?Katsuyama
Copy Local = true would probably correct that for the 3rd party .dll.. another alternative would be to add a Lib Folder to the project and place all the .dll's there that you know would be necessary for all builds and deployment..Shekinah
Yes. I set properties as Copy Local = true. But the problem is in serverside. Is there anything I need to add the reference in the project. Somebody suggests to create Global.asax.cs. I tried that but still the error happens.Jakie
U
9

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>
Untitled answered 17/8, 2019 at 7:35 Comment(1)
Thank you this works for me in an old winforms application with sqlce4Dixie
O
1

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.

Ose answered 25/7, 2016 at 14:56 Comment(0)
H
0

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.

Heathcote answered 18/7, 2021 at 12:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.