Base solution for your next web application
Open Closed

Web api rebuild: internal server error at two app services #1331


User avatar
0
patrickglaudemans created

Hi,

a very odd issue here. While debugging and running the application I change some frontend angular code, the dynamic web api layer then gets rebuild. After that - two of my app services are returning 'internal server error' errors from all methods. After a complete rebuild of the solution, it's working again,including the two services. Both failing services are having a reference to a custom module Reporting.Core

When debugging the internal server error, is says it has dependencies that failed registering: "Can't create component 'Intertek.BI.Reporting.Reports.ReportAppService' as it has dependencies to be satisfied.\r\n\r\n'Intertek.BI.Reporting.Reports.ReportAppService' is waiting for the following dependencies:\r\n- Service 'Intertek.BI.Reporting.Core.ReportManager' which was not registered.\

How should I proceed into resolving the cause of this error which only occurs after some sort of rebuild after frontend code change!


4 Answer(s)
  • User Avatar
    0
    hikalkan created
    Support Team

    Have you registered your ReportManager to Dependency Injection? Do you derive it from DomainService or implement ITransientDependency or something similar described here: <a class="postlink" href="http://www.aspnetboilerplate.com/Pages/Documents/Dependency-Injection">http://www.aspnetboilerplate.com/Pages/ ... -Injection</a> ?

  • User Avatar
    0
    patrickglaudemans created

    Hi,

    ITransientDependency: Yes DomainService: No

    It is odd that when running, after an api (re)build this behaviour occurs. It is building and working ok until that rebuild starts (after changing and saving app.js - for instance).

    Do you have additional info on how and when this rebuild is triggered? What's the difference between a normal solution build and the web api rebuild when running the app?

    Thanks - maybe we can solve it before tomorrow ;-)

  • User Avatar
    0
    patrickglaudemans created

    Hi,

    Resolved this by adding an extra dependency to the application layer module, like so:

    /// <summary>
        /// Application layer module of the application.
        /// </summary>
        [DependsOn(
            typeof(BICoreModule),
            typeof(Reporting.Core.BIReportingCoreModule)
            )]
    

    The Reporting.Core.BIReportingCoreModule provides the ReportManager what gives the dep. error. It remains unclear why a rebuild from within the solution did not reveal this dependency need.

    There is difference between a ASP.NET build triggered by IIS rather then a normal solution build.

    Thanks for reading ;-)

  • User Avatar
    0
    hikalkan created
    Support Team

    Hi,

    You should always declare module dependencies explictly. When I first design it, it was searching all dlls to find modules in all assemblies. But this makes app start slower. So, I changed default behaviour.

    FYI, Have a nice day.