title: Value cannot be null. Parameter name: address at IdentityModel.Client.TokenClient
body: <p>We have create IdentityServer4 application with ASP.NET Core(<a href="http://docs.identityserver.io/en/release/quickstarts/0_overview.html" rel="nofollow noreferrer">http://docs.identityserver.io/en/release/quickstarts/0_overview.html</a>) and deployed it on our qa server(i.e. <a href="https://identityserver.mydomain.com" rel="nofollow noreferrer">https://identityserver.mydomain.com</a>). We have also created the AWS Server application in .NET Core(<a href="https://aws.amazon.com/blogs/developer/preview-of-the-aws-toolkit-for-visual-studio-2017/" rel="nofollow noreferrer">https://aws.amazon.com/blogs/developer/preview-of-the-aws-toolkit-for-visual-studio-2017/</a>) and this serverless application internally call the <code>connect/token</code> endpoint of identity server application.(i.e. <a href="https://identityserver.mydomain.com/connect/token" rel="nofollow noreferrer">https://identityserver.mydomain.com/connect/token</a>).</p>
  
  <pre><code>public async Task&lt;TokenResponse&gt; CreateAccessToken(string baseUrl, string client, string clientSecret, string scope)
      {
          //discover endpoints from metadata
          var disco = await DiscoveryClient.GetAsync(baseUrl);
          //request token
          var tokenClient = new TokenClient(disco.TokenEndpoint, client, clientSecret);
          var tokenResponse = await tokenClient.RequestClientCredentialsAsync(scope: scope);
          return tokenResponse;
      }
  </code></pre>
  
  <p>Everything is working on our localhost but after deploying the Serverless application on AWS we are getting following error:</p>
  
  <pre><code>    Unknown error responding to request: ArgumentNullException:
  System.ArgumentNullException: Value cannot be null.
  Parameter name: address
  at IdentityModel.Client.TokenClient..ctor(String address, HttpMessageHandler innerHttpMessageHandler)
  at IdentityModel.Client.TokenClient..ctor(String address, String clientId, String clientSecret, HttpMessageHandler innerHttpMessageHandler, AuthenticationStyle style)
  at F2C.MAP.API.AWSLambda.IdentityServer.Client.IdentityServerApiClient.&lt;CreateAccessToken&gt;d__0.MoveNext() in E:\Rakesh_Kumar\Online_TFS\MAP\API\Auth\_trunk\F2C.MAP.API\F2C.MAP.API.AWSLambda.IdentityServer.Client\IdentityServerApiClient.cs:line 22
  --- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
  at F2C.MAP.API.AWSLambda.PublicAPI.Controllers.AuthorizeController.&lt;Get&gt;d__3.MoveNext() in E:\Rakesh_Kumar\Online_TFS\MAP\API\Auth\_trunk\F2C.MAP.API\F2C.MAP.API.AWSLambda.PublicAPI\Controllers\AuthorizeController.cs:line 47
  --- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
  at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
  at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.&lt;InvokeActionMethodAsync&gt;d__12.MoveNext()
  --- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
  at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.&lt;InvokeNextActionFilterAsync&gt;d__10.MoveNext()
  --- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
  at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)
  at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State&amp; next, Scope&amp; scope, Object&amp; state, Boolean&amp; isCompleted)
  at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.&lt;InvokeInnerFilterAsync&gt;d__14.MoveNext()
  --- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
  at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.&lt;InvokeFilterPipelineAsync&gt;d__17.MoveNext()
  --- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
  at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.&lt;InvokeAsync&gt;d__15.MoveNext()
  --- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
  at Microsoft.AspNetCore.Builder.RouterMiddleware.&lt;Invoke&gt;d__4.MoveNext()
  --- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
  at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.&lt;Invoke&gt;d__6.MoveNext()
  --- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
  at SimpleInjector.Integration.AspNetCore.RequestScopingStartupFilter.&lt;&lt;ConfigureRequestScoping&gt;b__3_0&gt;d.MoveNext()
  --- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
  at Microsoft.AspNetCore.Hosting.Internal.RequestServicesContainerMiddleware.&lt;Invoke&gt;d__3.MoveNext()
  --- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
  at Amazon.Lambda.AspNetCoreServer.APIGatewayProxyFunction.&lt;ProcessRequest&gt;d__16.MoveNext()
  ArgumentNullException:
  System.ArgumentNullException: Value cannot be null.
  Parameter name: address
  at IdentityModel.Client.TokenClient..ctor(String address, HttpMessageHandler innerHttpMessageHandler)
  at IdentityModel.Client.TokenClient..ctor(String address, String clientId, String clientSecret, HttpMessageHandler innerHttpMessageHandler, AuthenticationStyle style)
  at F2C.MAP.API.AWSLambda.IdentityServer.Client.IdentityServerApiClient.&lt;CreateAccessToken&gt;d__0.MoveNext() in E:\Rakesh_Kumar\Online_TFS\MAP\API\Auth\_trunk\F2C.MAP.API\F2C.MAP.API.AWSLambda.IdentityServer.Client\IdentityServerApiClient.cs:line 22
  --- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
  at F2C.MAP.API.AWSLambda.PublicAPI.Controllers.AuthorizeController.&lt;Get&gt;d__3.MoveNext() in E:\Rakesh_Kumar\Online_TFS\MAP\API\Auth\_trunk\F2C.MAP.API\F2C.MAP.API.AWSLambda.PublicAPI\Controllers\AuthorizeController.cs:line 47
  --- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
  at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
  at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.&lt;InvokeActionMethodAsync&gt;d__12.MoveNext()
  --- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
  at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.&lt;InvokeNextActionFilterAsync&gt;d__10.MoveNext()
  --- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
  at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)
  at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State&amp; next, Scope&amp; scope, Object&amp; state, Boolean&amp; isCompleted)
  at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.&lt;InvokeInnerFilterAsync&gt;d__14.MoveNext()
  --- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
  at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.&lt;InvokeFilterPipelineAsync&gt;d__17.MoveNext()
  --- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
  at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.&lt;InvokeAsync&gt;d__15.MoveNext()
  --- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
  at Microsoft.AspNetCore.Builder.RouterMiddleware.&lt;Invoke&gt;d__4.MoveNext()
  --- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
  at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.&lt;Invoke&gt;d__6.MoveNext()
  --- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
  at SimpleInjector.Integration.AspNetCore.RequestScopingStartupFilter.&lt;&lt;ConfigureRequestScoping&gt;b__3_0&gt;d.MoveNext()
  --- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
  at Microsoft.AspNetCore.Hosting.Internal.RequestServicesContainerMiddleware.&lt;Invoke&gt;d__3.MoveNext()
  --- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
  at Amazon.Lambda.AspNetCoreServer.APIGatewayProxyFunction.&lt;ProcessRequest&gt;d__16.MoveNext()
  </code></pre>