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

前端 未结 9 2517
谎友^
谎友^ 2021-02-12 13:05

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 particula

9条回答
  •  旧巷少年郎
    2021-02-12 13:43

    I had this problem but I found a solution for it. I had some new entities with the System.Data.Entity.Spatial.DbGeometry type and I kept getting the System.DllNotFoundException: Unable to load DLL 'SqlServerSpatial140.dll' when I ran the Add-Migration command. I had installed the SqlServerTypes library from nuget, which placed a folder in my solution like @mattavatar's post illustrated, but I was still getting the exception.

    What fixed it for me was copying these DLLs to C:\Windows\SysWOW64. This is dependent on the architecture of your machine, and your IIS configuration. For my I am running on a 64 bit machine, but IIS is configured to run 32 bit apps. In this case, I had to copy the 32 bit dll to C:\Windows\SysWOW64. If you're running a 32 bit machine, you'll want to copy the 32 bit dll to C:\Windows\System32. If you copy a 64 bit dll where it is expecting a 32 bit one, and you run the Add-Migration command, you'll get the System.BadImageFormatException.

    Hopefully this helps someone. I spent want too long trying to figure this out. Credit to @pflous' comment https://stackoverflow.com/a/39009634/6697928

提交回复
热议问题