title: Calling a referenced dll from WebAPI works locally but not on server
body: <p>I have a WebAPI that I have Cors enabled.</p>
  
  <p>My webAPI references a Class library that I do a lot of the processing in.</p>
  
  <p>calls between the WebAPI and Class library and also some calls inside the class library are </p>
  
  <p>throwing this error...</p>
  
  <pre><code>{"Message":"An error has occurred.","ExceptionMessage":"Object reference not set to an instance of an object.",
  "ExceptionType":"System.NullReferenceException","StackTrace":"   
  at RCIS.MappingServices.WebAPI.Utilities.SQL.SQLInsertObjects(Int32 TypeMapId, Int32 GrowerId, Int32 CropYear, String NAME, String SHAPE, String CREATED_BY, String CREATED_DATETIME, String MODIFIED_BY, String MODIFIED_DATETIME, String IsDELETED)\r\n   
  at RCIS.MappingServices.WebAPI.Controllers.PostObjectsController.GET(String TypeMapId, String GrowerId, String CropYear, String NAME, String SHAPE)\r\n   
  at lambda_method(Closure , Object , Object[] )\r\n   
  at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.&lt;&gt;c__DisplayClass10.&lt;GetExecutor&gt;b__9(Object instance, Object[] methodParameters)\r\n   
  at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments)\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, 
  IDictionary`2 arguments, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   
  at System.Web.Http.Controllers.ApiControllerActionInvoker.&lt;InvokeActionAsyncCore&gt;d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   
  at System.Web.Http.Controllers.ActionFilterResult.&lt;ExecuteAsync&gt;d__2.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   
  at System.Web.Http.Dispatcher.HttpControllerDispatcher.&lt;SendAsync&gt;d__1.MoveNext()"}
  </code></pre>
  
  <p>This Only seems to be happening when calling the class library from the server (i.e.) I enter a URL into Chrome calling the WebAPI method and get this error back.</p>
  
  <p>If I use all primitive types in the WebAPI and In the class library I get a success message back.</p>
  
  <p>If you have any questions please let me know.
  Any help on this would be greatly appreciated I have been trying to solve this for 2 days!!! </p>