title: No connection could be made because the target machine actively refused it 127.0.0.1:27681
body: <p>My project is an Asp.Net web site developed using visual studio 2015 (.Net framework: 4).</p>
  
  <p>Its a WebApi and MVC two in one project and working fine on my development machine. But after publishing on another laptop and on smarterASP free hosting, I'm getting this error on pages that have Database calls (Entity Framework 6)</p>
  
  <blockquote>
    <p>No connection could be made because the target machine actively refused it 127.0.0.1:27681</p>
    
    <p>An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.</p>
    
    <p>[SocketException (0x274d): No connection could be made because the target machine actively refused it 127.0.0.1:27681]
           System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult) +6769080
           System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket&amp; socket, IPAddress&amp; address, ConnectSocketState state, IAsyncResult asyncResult, Exception&amp; exception) +249</p>
    
    <p>[WebException: Unable to connect to the remote server]
           System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult) +606
           System.Net.Http.HttpClientHandler.GetResponseCallback(IAsyncResult ar) +64</p>
    
    <p>[HttpRequestException: An error occurred while sending the request.]
           System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +99
           System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58
           Lewisham.Controllers.d__1.MoveNext() +293
           System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +99
           System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58
           System.Web.Mvc.Async.TaskAsyncActionDescriptor.EndExecute(IAsyncResult asyncResult) +97
           System.Web.Mvc.Async.&lt;>c__DisplayClass37.b__36(IAsyncResult asyncResult) +17
           System.Web.Mvc.Async.WrappedAsyncResult1.CallEndDelegate(IAsyncResult asyncResult) +10
           System.Web.Mvc.Async.WrappedAsyncResultBase1.End() +49
           System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +32
           System.Web.Mvc.Async.AsyncInvocationWithFilters.b__3d() +50
           System.Web.Mvc.Async.&lt;>c__DisplayClass46.b__3f() +225
           System.Web.Mvc.Async.&lt;>c__DisplayClass33.b__32(IAsyncResult asyncResult) +10
           System.Web.Mvc.Async.WrappedAsyncResult1.CallEndDelegate(IAsyncResult asyncResult) +10
           System.Web.Mvc.Async.WrappedAsyncResultBase1.End() +49
           System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +34
           System.Web.Mvc.Async.&lt;>c__DisplayClass2b.b__1c() +26
           System.Web.Mvc.Async.&lt;>c__DisplayClass21.b__1e(IAsyncResult asyncResult) +100
           System.Web.Mvc.Async.WrappedAsyncResult1.CallEndDelegate(IAsyncResult asyncResult) +10
           System.Web.Mvc.Async.WrappedAsyncResultBase1.End() +49
           System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +27
           System.Web.Mvc.Controller.b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +13
           System.Web.Mvc.Async.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult) +29
           System.Web.Mvc.Async.WrappedAsyncResultBase1.End() +49
           System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +36
           System.Web.Mvc.Controller.b__15(IAsyncResult asyncResult, Controller controller) +12
           System.Web.Mvc.Async.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult) +22
           System.Web.Mvc.Async.WrappedAsyncResultBase1.End() +49
           System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +26
           System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +10
           System.Web.Mvc.MvcHandler.b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +21
           System.Web.Mvc.Async.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult) +29
           System.Web.Mvc.Async.WrappedAsyncResultBase1.End() +49
           System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +28
           System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
           System.Web.CallHandlerExecutionStep.OnAsyncHandlerCompletion(IAsyncResult ar) +129</p>
  </blockquote>
  
  <p>When I run the site on local with the DB Connection pointed to the remote DB it is working properly.</p>