none
Microsoft.SQLServer.Types & SQLServerSpatial.dll issues on Azure

    Question

  • Hello, I am trying to run a spatial/mapping ASP.NET application in my Azure environment. Everything works fine in development and on our internal servers. However when I publish to Azure, I get errors regarding missing SQLServerSpatial.dll. I have tried adding various versions of this file and nothing works. I have followed the following articles with no success and have wasted days on this already. I hope someone can help me!

    http://rexdotnet.blogspot.com/2010/04/using-sql-server-spatial-library-in.html

    http://alastaira.wordpress.com/2011/08/19/spatial-applications-in-windows-azure-redux-including-denali/

    Ideally, I would like to just change this to use the v11 (I am currently using v10 dlls) libraries as described in the second link but when I do this, I continually get errors that v10.0.0 can not be found. I have recreated everything and double checked the references in my project files and everything is set to v11 but it still looks for v10. When I use v10, it wants the VCR80(Visual C++) dlls giving me side by side errors. When I include the correct version for those in my application, I get 'Could not load fiel or assembly msvcm80.dll' even though this and the correct version of the other C++ dlls are now in my bin dir.

    Has anyone been able to get the managed spatial types library to work in Azure? I am close to moving everything into store procedures, but would prefer to be able to convert WKB/WKT/Etc within my features/shape classes without hitting the db. Any help would be greatly appreciated. Thank you!

    Monday, July 09, 2012 6:38 PM

Answers

  • Ok, so I have found a working (although cumbersome) solution. The VC++ libraries in the bin dir cause exceptions, so I tried manually installing the VC++ 2005 redistributable on my Azure instance VM via RDP. This works! So now I guess I will just create a startup task to install this on all my VM instances. Not pretty, but it should work. I hope that someone at Microsoft can provide a fix for this going forward. 
    • Marked as answer by davenexrf Wednesday, July 11, 2012 6:38 PM
    Wednesday, July 11, 2012 6:06 PM

All replies

  • Hi,

    Can you easily remote desktop to the Azure instance(s) and see if the SQLServerSpatial.dll is actually copied to the BIN folder of your (WebRole/WorkerRole) deployment?

    And also right-click those DLLs in Visual Studio and double-check if you have Copy to Output Directory with Copy Always selected.



    Cheers, Carlos Sardo

    Tuesday, July 10, 2012 10:25 PM
  • Hi Carlos, thanks for the reply. Yes, I have my staging environment set to just one instance and am using RDP to verify (and sometimes just copy files in manually) published files in my bin dir. Everything is set to always copy local, even including the VC++ libraries that were being required on some of the versions on the unmanaged SQLServerSPatil.dll. Everything is there and I have tried just about every version possible with no success. 
    Tuesday, July 10, 2012 10:37 PM
  • I was able to do this for my backup tool. It also took me a while to figure that out, but I can't think of what could be going wrong in your case. This is what I have:

    - SqlServerSpatial.dll in the root of the project (this is a requirement) version 10.50.1750.9 (it needs to be 10.50.* - higher version may work, not sure) -  Build Action set to Content and Copy to Output Directory set to Copy Always

    - Reference to Microsoft.SqlServer.Types version v2.0.50727 - I found mine under C:\Program Files (x86)\Microsoft SQL Server\100\SDK\Assemblies\Microsoft.SqlServer.Types.dll and also set to Copy Local

    There were no other dll dependencies that were set on my end; that made it work for me. I did however play with many versions of that DLL before finding the one that would work.


    Herve Roggero, MVP SQL Azure Co-Author: Pro SQL Azure http://www.herveroggero.com

    Wednesday, July 11, 2012 2:44 AM
  • Thank you Herve. Good to know it is possible to get this to work and helpful to know that I need to focus on 10.5. I will keep hacking at this.

    So I have Microsoft.SqlServer.Types.dll, version 10.50.3720.0, referenced in my project and set to copy always. As you said, I pulled this from my C:\Program Files (x86)\Microsoft SQL Server\100\SDK\Assemblies directory. When you look at the properties in VS for this reference, the target runtime is v2.0.50727 as you mentioned above. If 10.50.1750.9 definitely works, I would love to get my hands on that version. I have no idea how I would find that specific release.

    I also have the unmanaged SQLServerSpatial.dll, version 10.50.3720.0, included in the root of my project and set to always copy local. I got this file from my Windows\System32 dir. When I publish to Azure, this file is in the root directory and in bin. 

    With this configuration, I still get:

    Unable to load DLL 'SqlServerSpatial.dll': The application has failed to start because its side-by-side configuration is incorrect.

    In the event log, again I get the error: 

    Activation context generation failed for "E:\sitesroot\0\bin\SqlServerSpatial.dll". Dependent Assembly Microsoft.VC80.CRT,processorArchitecture="amd64",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="8.0.50727.4027" could not be found. Please use sxstrace.exe for detailed diagnosis.

    I have run the sxstrace and it doesn't give me much more information. I have tried including the VC++ libs (msvcm80.fdll, msvcp80.dll & msvcr80.dll) in my project similarly to how I am including the SQLServerSpatial.dll, but I get errors on the initial page loads when I do this. This is so frustrating, I hope someone has seen this before? 




    • Edited by davenexrf Wednesday, July 11, 2012 5:03 PM
    • Marked as answer by davenexrf Wednesday, July 11, 2012 6:07 PM
    • Unmarked as answer by davenexrf Wednesday, July 11, 2012 6:38 PM
    Wednesday, July 11, 2012 5:01 PM
  • Ok, so I have found a working (although cumbersome) solution. The VC++ libraries in the bin dir cause exceptions, so I tried manually installing the VC++ 2005 redistributable on my Azure instance VM via RDP. This works! So now I guess I will just create a startup task to install this on all my VM instances. Not pretty, but it should work. I hope that someone at Microsoft can provide a fix for this going forward. 
    • Marked as answer by davenexrf Wednesday, July 11, 2012 6:38 PM
    Wednesday, July 11, 2012 6:06 PM
  • Finally work for me using then SQLServerSpatial.dll ( 32 bits ) version 10.50.1447.4 copy in the bin directory.

    Too many hours work in that.

    Sunday, November 10, 2013 7:47 PM