I have seen questions regarding this but not exactly my scenario:
I have created a service. It runs on one server that is also a web server. It looks at a remote server running SQL Server to gather data to run.
When getting data from one of the tables, there is a column with a geography data type. In the web application that is running, no problems getting this table as Microsoft.SqlServer.Types.dll
is referenced.
A service running on the Web server creates and error:
DataReader.GetFieldType(22) returned null.
When doing a select statement on this remote machine even the same dll is referenced.
Very Strange. The query is a very basic "Select * from ..... where ....."
I kept searching and found a post suggesting setting the reference to the Microsoft.SqlServer.Types.dll from the following folder:
C:\Program Files\Microsoft SQL Server\110\Shared
I made the change. Copied the recompiled service with the new dll to the installed folder on the web server and now it completes without the error.
I didn't create the original code so I am not sure where the original dll reference came from.