Base solution for your next web application
Open Closed

GraphQL - Server cannot be reached #6921


User avatar
0
BTSDEV created

Hi, I am trying to integrate the GraphQL project into my solution. I am getting my following error. can you please help me out?

It is failing to resolve the RoleQuery. I commented out other query for simplicity for the debugging.

Castle.MicroKernel.Handlers.HandlerException
  HResult=0x80131500
  Message=Can't create component '...Queries.Container.QueryContainer_f5789103-84f9-497e-b945-fe2b3aaf5af9' as it has dependencies to be satisfied.

'..Queries.Container.QueryContainer_f5789103-84f9-497e-b945-fe2b3aaf5af9' is waiting for the following dependencies:
- Service '..Queries.RoleQuery' which was not registered.

  Source=Castle.Windsor
  StackTrace:
   at Castle.MicroKernel.Handlers.DefaultHandler.AssertNotWaitingForDependency()
   at Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(CreationContext context, Boolean requiresDecommission, Boolean instanceRequired, Burden& burden)
   at Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext context, Boolean instanceRequired)
   at Castle.MicroKernel.DefaultKernel.ResolveComponent(IHandler handler, Type service, IDictionary additionalArguments, IReleasePolicy policy, Boolean ignoreParentContext)
   at Castle.MicroKernel.DefaultKernel.Castle.MicroKernel.IKernelInternal.Resolve(Type service, IDictionary arguments, IReleasePolicy policy, Boolean ignoreParentContext)
   at Castle.MicroKernel.DefaultKernel.Resolve(Type service, IDictionary arguments)
   at Castle.Windsor.MsDependencyInjection.ScopedWindsorServiceProvider.GetServiceInternal(Type serviceType, Boolean isOptional)
   at GraphQL.FuncDependencyResolver.Resolve[T]()
   at BizTech.CorsanPortal.Schemas.MainSchema..ctor(IDependencyResolver resolver) in D:\Projects\repos\new4172019\CorsanPortal\aspnet-core\BizTech.CorsanPortal.GraphQL\Schemas\MainSchema.cs:line 13

Thanks, BtsDev


14 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    Have you seen Zero's code? You can compare and see if you missed the code.

    https://github.com/aspnetzero/aspnet-zero-core/tree/dev/aspnet-core/src/MyCompanyName.AbpZeroTemplate.GraphQL

  • User Avatar
    0
    ryancyq created
    Support Team

    Hi, can you try resolving QueryContainer instead of RoleQuery in the MainSchema?

    You should follow similar project structure and initialization code as ANZ Graphql project so that if there is any bugfix or enhancement, you can patch it easily

  • User Avatar
    0
    alper created
    Support Team

    Did you create an AbpModule in your new GraphQL project? like this https://github.com/aspnetzero/aspnet-zero-core/blob/819e792338a9bf4ae49df4327a2c4e5609cdfd87/aspnet-core/src/MyCompanyName.AbpZeroTemplate.GraphQL/Startup/AbpZeroTemplateGraphQLModule.cs

  • User Avatar
    0
    BTSDEV created

    @maliming, the link you have posted deosnt exists. can you please re-post the corect link pls?

    @ryancyq, I am resolving QueryContainer in MainSchema. Below is constructor of MainSchema class: public MainSchema(IDependencyResolver resolver) : base(resolver) { Query = resolver.Resolve<QueryContainer>(); }

    @alpher, I have created MyProjectGraphQLModule in the GrapQL project, which inherts the AbpModule. Btw, then link you have posted doesnt exists. can you please re-post the correct link pls?

  • User Avatar
    0
    maliming created
    Support Team

    @BTSDEV

    then link you have posted doesnt exists

    You can invite anyone to become a member of the ASP.NET Zero organization using their GitHub username. And they can access the ASP.NET Zero private GitHub repositories.

    https://aspnetzero.com/LicenseManagement

  • User Avatar
    0
    BTSDEV created

    @maliming, thank you for the response. I can access the link now. Will feedback after comparing the code.

  • User Avatar
    0
    BTSDEV created

    @maliming, I have compared the code with Zero's code: MyCompanyName.AbpZeroTemplate.GraphQL. all the files are identical except companyname in the namespace. Any idea what might be wrong?

    Also, It fails on this below line in MainSchema.cs Query = resolver.Resolve<QueryContainer>();

    Appreciate your help!!

  • User Avatar
    0
    BTSDEV created

    @alper, I have created AbpZeroTemplateGraphQLModule as exactly as specified. Please let me know if there is anything tha I needed to check on.

  • User Avatar
    0
    maliming created
    Support Team

    Hi BTSDEV

    If you download a Zero demo project, will there still be an error?

    If the demo project has no errors, it means that your code and Zero still have different places.

    You can download and try it out.

  • User Avatar
    0
    BTSDEV created

    Hi Mailming, Thank you for your prompt reply. I downloaded the demo project. it works. no errors. When I try to integrate the GraphQL project to m production project, it is failing when It tries to Resolve QueryContainer in MainSchema class. Is there any spot that I shoudl be lookign at?

    Please see the error at the GraphQL play ground

    Thank you for your time!

  • User Avatar
    0
    maliming created
    Support Team

    The easiest way is to compare the code.

    If you can't solve it, it is convenient to share your project source code to: [email protected]?

  • User Avatar
    0
    BTSDEV created

    Hi maliming , Did you get my email with source code? Please confirm the receipt of the email.

    Thank you for your time ad help wit this issue.

    Thanks.

  • User Avatar
    1
    maliming created
    Support Team

    @BTSDEV

    Very simple modifications can fix the problem you are experiencing.

  • User Avatar
    0
    BTSDEV created

    Thank you @maliming for your time and help. after adding the dependency, as you have specified, it resolved the problem.