+2 votes
1 view
in Azure by (8.3k points)

I'm trying to make a webapi in ASP.NET MVC 4. The webapi used Entity Framework 5 Spatial types and I have written a very simple code.

  public List<Area> GetAllAreas()

    {

        List<Area> aList = db.Areas.ToList();

        return aList;

    }

The area contains DbGeometry.

When I run this local it works, but when I publish it to Azure it gives me this error:

Spatial types and functions are not available for this provider because of the assembly 'Microsoft.SqlServer.Types' version 10 or higher could not be found.

Does anyone know how to resolve this? :)

Thanks!

1 Answer

+2 votes
by (16.8k points)
edited by

A simple solution this, you just need to install a NuGet package that is: Microsoft.SqlServer.Types NuGet package

Looking for Azure material from basics! Refer to this video on Azure provided by Intellipaat:

Just type: 

PM> Install-Package Microsoft.SqlServer.Types

Now you are good to go.

FYI: I took reference from this blog.

...