未处理的聚合异常

Unhandled Aggregate Exception

我已按照 (http://www.c-sharpcorner.com/UploadFile/a6fd36/understand-self-host-of-a-web-apiC-Sharp/ ) and ( http://www.c-sharpcorner.com/uploadfile/a6fd36/understanding-how-to-call-the-web-api-from-a-client-applica/) 中的教程进行操作,但似乎仍在

上获得 System.AggregateException
                 //Call HttpClient.GetAsync to send a GET request to the appropriate URI   
            HttpResponseMessage resp = client.GetAsync("api/books").Result;

                var resp = client.GetAsync(string.Format("api/books/{0}", id)).Result;

                var resp = client.GetAsync(query).Result;

错误状态:'System.AggregateException' 类型的未处理异常发生在 mscorlib.dll

异常详细信息 -

  System.AggregateException was unhandled
  HResult=-2146233088
   Message=One or more errors occurred.
   Source=mscorlib
  StackTrace:
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at System.Threading.Tasks.Task`1.get_Result()
   at TestClient.Program.ListAllBooks() in c:\Users\wa\Documents\Visual Studio 2013\Projects\SelfHost\TestClient\Program.cs:line 35
   at TestClient.Program.Main(String[] args) in c:\Users\wa\Documents\Visual Studio 2013\Projects\SelfHost\TestClient\Program.cs:line 20
   at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()
  InnerException: System.Net.Http.HttpRequestException
   HResult=-2146233088
   Message=An error occurred while sending the request.
   InnerException: System.Net.WebException
        HResult=-2146233079
        Message=Unable to connect to the remote server
        Source=System
        StackTrace:
             at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
             at System.Net.Http.HttpClientHandler.GetResponseCallback(IAsyncResult ar)
        InnerException: System.Net.Sockets.SocketException
             HResult=-2147467259
             Message=No connection could be made because the target machine actively refused it [::1]:8080
             Source=System
             ErrorCode=10061
             NativeErrorCode=10061
             StackTrace:
                  at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)
                  at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
             InnerException: 

有什么想法吗?

谢谢

请阅读最后一行:)

InnerException: System.Net.WebException
        HResult=-2146233079
        Message=Unable to connect to the remote server