title: Error in my Web API C# using Entity Framework with SQL Server
body: <p>I have an API in C#. My code is running fine off line but when I up to my server on 1 and 1 I received this error message:</p>
  
  <blockquote>
    <p>Message: "An error has occurred."</p>
    
    <p>ExceptionMessage: "An error occurred when trying to create a controller of type 'ValuesController'. Make sure that the controller has a parameterless public constructor.",</p>
    
    <p>ExceptionType: "System.InvalidOperationException",</p>
    
    <p>StackTrace: </p>
    
    <p>at System.Web.Http.Dispatcher.DefaultHttpControllerActivator.Create(HttpRequestMessage request, HttpControllerDescriptor controllerDescriptor, Type controllerType)<br>
    at System.Web.Http.Controllers.HttpControllerDescriptor.CreateController(HttpRequestMessage request)<br>
    at System.Web.Http.Dispatcher.HttpControllerDispatcher.d__1.MoveNext()",</p>
    
    <p>InnerException: {<br>
    Message: "An error has occurred."<br>
    ExceptionMessage: "Object reference not set to an instance of an object."<br>
    ExceptionType: "System.NullReferenceException"  </p>
    
    <p>StackTrace:<br>
    at api4food.DataClasses1DataContext..ctor() in C:\Users\joao\Documents\Visual Studio 2017\Projects\api4food\api4food\DataClasses1.designer.cs:line 39<br>
    at lambda_method(Closure)<br>
    at System.Web.Http.Dispatcher.DefaultHttpControllerActivator.Create(HttpRequestMessage request, HttpControllerDescriptor controllerDescriptor, Type controllerType)</p>
  </blockquote>