title: Unable to resolve service for type 'xxxSchema' while attempting to activate 'GraphQL.Server.Internal.DefaultGraphQLExecuter
body: <p>I am following the sample on <a href="https://github.com/graphql-dotnet/server" rel="nofollow noreferrer">https://github.com/graphql-dotnet/server</a> to create a GraphQL but I am getting  the above error (Full version Below) when going to my http://localhost:5001/graphql.</p>
  <p>I have played around with Many aspects of asp.core DependencyInjections but it still comes back to this error:</p>
  <pre><code>    System.InvalidOperationException: Unable to resolve service for type 'MyProject.GraphQL.MySchema' while attempting to activate 'GraphQL.Server.Internal.DefaultGraphQLExecuter`1[MyProject.GraphQL.MySchema]'.
     at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateArgumentCallSites(Type serviceType, Type implementationType, CallSiteChain callSiteChain, ParameterInfo[] parameters, Boolean throwIfCallSiteNotFound)
     at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateConstructorCallSite(ResultCache lifetime, Type serviceType, Type implementationType, CallSiteChain callSiteChain)
     at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.TryCreateOpenGeneric(ServiceDescriptor descriptor, Type serviceType, CallSiteChain callSiteChain, Int32 slot, Boolean throwOnConstraintViolation)
     at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.TryCreateOpenGeneric(Type serviceType, CallSiteChain callSiteChain)
     at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateCallSite(Type serviceType, CallSiteChain callSiteChain)
     at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.&lt;&gt;c__DisplayClass7_0.&lt;GetCallSite&gt;b__0(Type type)
     at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
     at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.GetCallSite(Type serviceType, CallSiteChain callSiteChain)
     at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.CreateServiceAccessor(Type serviceType)
     at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
     at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope)
     at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType)
     at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
     at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
     at GraphQL.Server.Transports.AspNetCore.GraphQLHttpMiddleware`1.InvokeAsync(HttpContext context) in /_/src/Transports.AspNetCore/GraphQLHttpMiddleware.cs:line 136
     at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
  </code></pre>
  <p>Can anyone point me to the right direction to fix this please
  .Net Core 5.0;
  Latest Nuget GraphQL.Net Server</p>
  <p>My Startup.cs Code is</p>
  <pre><code>using GraphQL;
  using GraphQL.Server;
  using GraphQL.SystemTextJson;
  using GraphQL.Types;
  using Microsoft.AspNetCore.Builder;
  using Microsoft.AspNetCore.Hosting;
  using Microsoft.EntityFrameworkCore;
  using Microsoft.Extensions.Configuration;
  using Microsoft.Extensions.DependencyInjection;
  using Microsoft.Extensions.Hosting;
  using Serilog;
  
  namespace Ace.Aceterilize
  {
      public class Startup
      {
          public Startup(IConfiguration configuration, IWebHostEnvironment environment)
          {
              Configuration = configuration;
              Environment = environment;
          }
  
          public IConfiguration Configuration { get; }
  
          public IWebHostEnvironment Environment { get; }
          // This method gets called by the runtime. Use this method to add services to the container.
          public void ConfigureServices(IServiceCollection services)
          {
              services.AddDbContext&lt;MyDbContext&gt;(options =&gt; options.UseSqlServer(Configuration.GetConnectionString(&quot;DefaultConnection&quot;)), ServiceLifetime.Singleton);
  
              services.AddHttpContextAccessor();
              //GraphQL
              services.AddSingleton&lt;IDocumentExecuter, DocumentExecuter&gt;();
              services.AddSingleton&lt;IDocumentWriter, DocumentWriter&gt;();
  
              services.AddSingleton&lt;MyQuery&gt;();
              services.AddSingleton&lt;ISchema, MySchema&gt;();
  
              services.AddGraphQL((options, provider) =&gt;
          {
              options.EnableMetrics = Environment.IsDevelopment();
              var logger = provider.GetRequiredService&lt;ILogger&gt;();
              options.UnhandledExceptionDelegate = ctx =&gt; logger.Error(&quot;GraphQL: {Error} occurred&quot;, ctx.OriginalException.Message);
          })
           // Add required services for GraphQL request/response de/serialization
          .AddSystemTextJson(configureDeserializerSettings =&gt; { }, configureSerializerSettings =&gt; { })
          .AddErrorInfoProvider(opt =&gt; opt.ExposeExceptionStackTrace = Environment.IsDevelopment())
          .AddWebSockets() // Add required services for web socket support
          .AddDataLoader() // Add required services for DataLoader support
          .AddGraphTypes(typeof(AceteriliseSchema), ServiceLifetime.Transient);
  
              services.AddControllersWithViews();
  
          }
  
          // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
          public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
          {
              if (env.IsDevelopment())
              {
   //... Standard if development Mode
              }
  
              app.UseWebSockets();
              app.UseGraphQL&lt;MySchema, GraphQLHttpMiddlewareWithLogs&lt;MySchema&gt;&gt;();
              app.UseGraphQLWebSockets&lt;MySchema&gt;();
              // use graphiQL middleware at default path /ui/graphiql
              app.UseGraphiQLServer();
  
              // use graphql-playground middleware at default path /ui/playground
              app.UseGraphQLPlayground();
  
              // use altair middleware at default path /ui/altair
              app.UseGraphQLAltair();
  
              // use voyager middleware at default path /ui/voyager
              app.UseGraphQLVoyager();
  
            
          }
      }
  }
  </code></pre>
  <p>My Schema File</p>
  <pre><code>  public class MySchema : Schema,ISchema
      {
          public MySchema(IServiceProvider provider):base(provider)
          {
              {
                  Query = provider.GetRequiredService&lt;MyQuery&gt;();
            
              }
          }
      }
  </code></pre>
  <p>And My Query</p>
  <pre><code> public class MyQuery : ObjectGraphType
      {
          public MyQuery(MyDbContext db)
          {
  
              Field&lt;ListGraphType&lt;ApplicationUserType&gt;&gt;(&quot;users&quot;, &quot;List of Active Users&quot;,
                    
                  resolve: context =&gt; db.ApplicationUsers.Where(u =&gt; !u.IsDeleted));
          }
      }
  
    public class ApplicationUserType : ObjectGraphType&lt;ApplicationUser&gt;
      {
          public ApplicationUserType()
          {
              Field(t =&gt; t.Id);
              Field(t =&gt; t.UserName);
  }}}
  </code></pre>