[Resolved] : Unable to load DLL 'SqlServerSpatial110.dll': The specified module could not be found.

I was trying to use the SqlServer Spatial CLR types in a C# .Net project. I wanted to use SqlGeometry to query spatial records out of my db.

I then publish a WCF Rest service to my local IIS instance that has a service that hits the same class library as the unit test to do some spatial querying and it fails.

Following exception was logged.

Inner Exception :

 Message: Unable to load DLL 'SqlServerSpatial110.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E) HResult: -2146233052 Source: Microsoft.SqlServer.Types StackTrace: at Microsoft.SqlServer.Types.GLNativeMethods.SetClrFeatureSwitchMap(Int32 clrFeatureSwitchMap) at Microsoft.SqlServer.Types.SqlGeometry.IsValidExpensive() at Microsoft.SqlServer.Types.SqlGeometry.Construct(GeoData g, Int32 srid) at Microsoft.SqlServer.Types.SqlGeometry.GeometryFromText(OpenGisType type, SqlChars text, Int32 srid) at Microsoft.SqlServer.Types.SqlGeometry.STGeomFromText(SqlChars geometryTaggedText, Int32 srid) at Microsoft.SqlServer.Types.SqlGeometry.Parse(SqlString s) TargetSite: Void SetClrFeatureSwitchMap(Int32)

Resolution : 

Add the reference of Microsoft.SqlServer.Types in Web.config of application resolved the issue.


<runtime>
   <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.SqlServer.Types" publicKeyToken="89845dcd8080cc91" />
        <bindingRedirect oldVersion="1.0.0.0-11.0.0.0" newVersion="10.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>


Regards,
Farhan Jamil
Senior Software Engineer
Systems Limited,Pakistan


Comments

Popular posts from this blog

Issues After upgrading BizTalk 2013 to BizTalk 2013 R2 - Could not load file or assembly 'Microsoft.BizTalk.Interop.SSOClient

Creating Custom Pipeline Component and Pipeline for Reading Excel File in BizTalk