title: System.Net.WebException: The remote server returned an error: (429) Too Many Requests
body: <p>I am working on API development project using ASP.NET Core 2.2, GraphQL.NET , CosmosDB, EntityFrameworkCore (Microsoft.EntityFrameworkCore.Cosmos(2.2.4).</p>
  
  <p>On running the solution, I see an error in the output window of the VS2019:</p>
  
  <pre><code>System.Net.WebException: The remote server returned an error: (429) Too Many Requests.
     at System.Net.HttpWebRequest.GetResponse()
     at Microsoft.EntityFrameworkCore.Cosmos.Storage.Internal.CosmosClient.CreateDocumentCollectionIfNotExistsOnce(DbContext _, String collectionId)
     at Microsoft.EntityFrameworkCore.Storage.ExecutionStrategy.ExecuteImplementation[TState,TResult](Func`3 operation, Func`3 verifySucceeded, TState state)
  Microsoft.AspNetCore.Hosting.Internal.WebHost:Information: Request finished in 119926.3431ms 200 application/json
  Microsoft.AspNetCore.Hosting.Internal.WebHost:Information: Request starting HTTP/1.1 POST http://localhost:53116/graphql application/json 1468
  Microsoft.EntityFrameworkCore.Infrastructure:Information: Entity Framework Core 2.2.4-servicing-10062 initialized 'TaxathandDbContext' using provider 'Microsoft.EntityFrameworkCore.Cosmos' with options: ServiceEndPoint=https://taxathanddb.documents.azure.com/ Database=TaxathandDb 
  Microsoft.EntityFrameworkCore.Infrastructure:Information: A transient exception has been encountered during execution and the operation will be retried after 9031ms.
  System.Net.WebException: The remote server returned an error: (429) Too Many Requests.
     at System.Net.HttpWebRequest.GetResponse()
     at Microsoft.EntityFrameworkCore.Cosmos.Storage.Internal.CosmosClient.CreateDocumentCollectionIfNotExistsOnce(DbContext _, String collectionId)
     at Microsoft.EntityFrameworkCore.Storage.ExecutionStrategy.ExecuteImplementation[TState,TResult](Func`3 operation, Func`3 verifySucceeded, TState state)
  </code></pre>
  
  <p><strong>Startup.cs</strong></p>
  
  <pre><code>public void ConfigureServices(IServiceCollection services)
  {
      string serviceEndPoint = Configuration.GetValue&lt;string&gt;("CosmosDBEndpoint");
      string authKeyOrResourceToken = Configuration.GetValue&lt;string&gt;("CosmosDBAccessKey");
      string databaseName = Configuration.GetValue&lt;string&gt;("CosmosDBName");
      services.AddEntityFrameworkCosmos();
      services.AddScoped&lt;DbContext, SampleDbContext&gt;();
      services.AddDbContext&lt;TaxathandDbContext&gt;(options =&gt; options.UseCosmos(serviceEndPoint, authKeyOrResourceToken, databaseName, contextOptions =&gt;
      {
          contextOptions.ExecutionStrategy(d =&gt; new CosmosExecutionStrategy(d));
      }
  
      ));
      services.Configure&lt;AppSettings&gt;(Configuration.GetSection("AppSettings"));
      services.AddSingleton&lt;IHttpContextAccessor, HttpContextAccessor&gt;();
      services.AddSingleton&lt;IDocumentExecuter, DocumentExecuter&gt;();
      services.AddSingleton&lt;IDataLoaderContextAccessor, DataLoaderContextAccessor&gt;();
      services.AddSingleton&lt;DataLoaderDocumentListener&gt;();
      services.AddSingleton&lt;IDocumentWriter, DocumentWriter&gt;();
      services.AddScoped&lt;IUtilityService, UtilityService&gt;();
      services.AddScoped&lt;ICommonService, CommonService&gt;();
      services.AddScoped&lt;ICountryService, CountryService&gt;();
      services.AddScoped&lt;CountryResultType&gt;();
      services.AddScoped&lt;GraphQLQuery&gt;();
      services.AddScoped&lt;ICountriesResolver, CountriesResolver&gt;();
      services.AddScoped&lt;CountryType&gt;();
      services.AddScoped&lt;Response&gt;();
      services.AddScoped(typeof(ResponseGraphType&lt;&gt;));
      services.AddScoped(typeof(ResponseListGraphType&lt;&gt;));
      services.AddTransient&lt;IAddressRepository, AddressRepository&gt;();
      services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Latest);
      services.AddGraphQL(o =&gt;
      {
          o.ExposeExceptions = true;
      }
  
      ).AddGraphTypes(ServiceLifetime.Scoped);
  
      services.AddScoped&lt;IDependencyResolver&gt;(s =&gt; new FuncDependencyResolver(s.GetRequiredService));
      services.AddScoped&lt;SampleSchema&gt;();
  }
  </code></pre>
  
  <p>Can anyone help me to fix this issue?</p>