I am developing an application that uses the SqlGeography and SqlGeometry data types from the SQL CLR datatypes installer. My application is a web application in VB.NET, and most of the functionality is in a class library. Both projects have a reference to Microsoft.SqlServer.Types.
dll, which is not
set to copy local.
The application works perfectly on my development machine where I also have a developer version of SQL Server 2008 installed. However when I deploy to my web server (a Windows Server 2008 R2 box over which I have full control), although the application runs, when I try to access a web service that uses the SQL Server spatial stuff, I hit this error:
Unable to load DLL 'SqlServerSpatial.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
at Microsoft.SqlServer.Types.GLNativeMethods.GeodeticDistance(GeoMarshalData g1, GeoMarshalData g2, EllipsoidParameters ellipsoidParameters, Double& result)
at Microsoft.SqlServer.Types.GLNativeMethods.GeodeticDistance(GeoData g1, GeoData g2, EllipsoidParameters ellipsoidParameters)
at Microsoft.SqlServer.Types.SqlGeography.STDistance(SqlGeography other)
at MyPlaceLib.MapFeatureManager.GetMapFeatures(List`1 layerNames, String q, LatLng origin, LatLngBounds bounds, Decimal radius, Int64 limit, MapFeatureSortOrder sortOrder, SortDirection sortDirection, Boolean singleResult, Boolean includeMapLayerDefinitions, Boolean allowReturnAllFeatures, Int64 allLayersLimit) in D:\Users\wwarby\Visual Studio 2010\Projects\MyPlace.NET\MyPlaceLib\Classes\MapFeatureManager.vb:line 184
at MyPlaceLib.HttpWebServices.GetMapFeatures.ProcessRequest(HttpContext context) in D:\Users\wwarby\Visual Studio 2010\Projects\MyPlace.NET\MyPlaceLib\Classes\HttpWebServices\GetMapFeatures.vb:line 43
I've got the SQL Server CLR types installed on the web server - Microsoft.SqlServer.Types.
dll is in the same place on Program Files on the server as on my dev machine. SqlServerSpatial.dll (not directly referenced anywhere in my code) is in system32 on the server, albeit a different version than on my development machine. I've tried copying both dlls to the bin directory of my app to no avail. and I've tried installing various versions of the Visual C++ runtime.