c# - SqlGeometry / DbGeometry Isvalid exception when hosting on Azure Web Role -


i'm trying create dbgeometry type polygon. works fine on local machine getting error on return statement when hosting website on azure web role.

code:

string polygon = “polygon ((-30.3637216 30.7124139,-30.3632216 30.7124139,-30.3632216 30.7129139,-30.3637216 30.7129139,-30.3637216 30.7124139))”;  return dbgeometry.fromtext(polygon, 4326); 

exception:

exception has been thrown target of invocation.   @ system.runtimemethodhandle.invokemethod(object target, object[] arguments, signature sig, boolean constructor)     @ system.reflection.runtimemethodinfo.unsafeinvokeinternal(object obj, object[] parameters, object[] arguments)     @ system.reflection.runtimemethodinfo.invoke(object obj, bindingflags invokeattr, binder binder, object[] parameters, cultureinfo culture)     @ system.data.sqlclient.sqlspatialservices.geometryfromtext(string geometrytext)     @ library.modules.findmyway.spatialfunctions.getdefaultbox(decimal latitude, decimal longitude)     @ library.stop.importstops(string username, ienumerable`1 stops, int32 companyid) inner exception:    @ microsoft.sqlserver.types.glnativemethods.isvalid(geomarshaldata g, boolean& result)     @ microsoft.sqlserver.types.glnativemethods.isvalid(geodata g)     @ microsoft.sqlserver.types.sqlgeometry.isvalidexpensive()     @ microsoft.sqlserver.types.sqlgeometry.geometryfromtext(opengistype type, sqlchars text, int32 srid)     @ microsoft.sqlserver.types.sqlgeometry.parse(sqlstring s) 

do have idea why polygon invalid?

okay fixed in roundabout way converting sqlgeometry dbgeometry:

is there dbgeometry makevalid in .net 4.5

sqlgeometry geom = sqlgeometry.stpolyfromtext(new sqlchars(new sqlstring(polygon)), 4326);                  return dbgeometry.frombinary(geom.stasbinary().buffer); 

this code produced exception:

unable load dll 'sqlserverspatial.dll': specified module not found. (exception hresult: 0x8007007e) 

to fix:

unable load dll 'sqlserverspatial.dll'

the 64 bit dll resulted in exception:

an attempt made load program incorrect format. (exception hresult: 0x8007000b) 

so had add 32bit dll project work azure.

result: fine now, i'm still not sure why dbgeometry not working on azure, not sure why 64bit dll not working on azure either.


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -