我正在尝试创建一个DbGeometry
类型多边形。它在我的本地计算机上运行良好,但在 Azure Web 角色上托管我的网站时,我在返回语句中出现错误。
代码:
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 has been thrown by the target of an invocation.
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Data.SqlClient.SqlSpatialServices.GeometryFromText(String geometryText)
at Library.Modules.FindMyWay.SpatialFunctions.GetDefaultBox(Decimal latitude, Decimal longitude)
at Library.Stop.ImportStops(String userName, IEnumerable`1 stops, Int32 companyId) Inner Exception: at Microsoft.SqlServer.Types.GLNativeMethods.IsValid(GeoMarshalData g, Boolean& result)
at Microsoft.SqlServer.Types.GLNativeMethods.IsValid(GeoData g)
at Microsoft.SqlServer.Types.SqlGeometry.IsValidExpensive()
at Microsoft.SqlServer.Types.SqlGeometry.GeometryFromText(OpenGisType type, SqlChars text, Int32 srid)
at Microsoft.SqlServer.Types.SqlGeometry.Parse(SqlString s)
你知道为什么这个多边形是无效的吗?