Base solution for your next web application
Open Closed

INjecting 3rd Party Controller #10567


User avatar
0
admin@SYNTAQ created

Prerequisites

Please answer the following questions before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.

  • What is your product version? 8.8
  • What is your product type (Angular or MVC)? MVC
  • What is product framework type (.net framework or .net core)? .Core

We are trying to inject a 3rd party spelling and grammar controller. We add the controlers and map the controllers as per the vendors instructions. Everything works as expected in a vanilla test project (asp.net core 3.1). But in ASPNETZERO a 500 error eror is thorwn when any api/RapidSpellAPI/... endpoints are requested. Can you provide any guidance on where to look or how to find the root 500 error? Or any general information about the middleware controllers that might be causing this issue?

        services.AddControllers().AddApplicationPart(System.Reflection.Assembly.Load(new System.Reflection.AssemblyName("Keyoti.RapidSpellWeb.ASP.NET.Core")));
        
        ......... 

            endpoints.MapRazorPages();
            endpoints.MapControllers();

5 Answer(s)
  • User Avatar
    0
    musa.demir created

    Hi @admin@syntaq

    Can you please share related part of the log file?

  • User Avatar
    0
    admin@SYNTAQ created

    HI,

    I have included the Detailed 500 error message from the log

    `HTTP Error 500.0 - Internal Server Error The page cannot be displayed because an internal server error has occurred.

    Most likely causes: IIS received the request; however, an internal error occurred during the processing of the request. The root cause of this error depends on which module handles the request and what was happening in the worker process when this error occurred. IIS was not able to access the web.config file for the Web site or application. This can occur if the NTFS permissions are set incorrectly. IIS was not able to process configuration for the Web site or application. The authenticated user does not have permission to use this DLL. The request is mapped to a managed handler but the .NET Extensibility Feature is not installed.

    Things you can try: Ensure that the NTFS permissions for the web.config file are correct and allow access to the Web server's machine account. Check the event logs to see if any additional information was logged. Verify the permissions for the DLL. Install the .NET Extensibility feature if the request is mapped to a managed handler. Create a tracing rule to track failed requests for this HTTP status code. For more information about creating a tracing rule for failed requests, click here.

    Detailed Error Information: Module AspNetCoreModule Notification ExecuteRequestHandler Handler aspNetCore Error Code 0x00000000 Requested URL https://syntaq-falcon-preprod__2475:80/api/RapidSpellAPI/Check Physical Path D:\home\site\wwwroot\api\RapidSpellAPI\Check Logon Method Anonymous Logon User Anonymous

    More Information: This error means that there was a problem while processing the request. The request was received by the Web server, but during processing a fatal error occurred, causing the 500 error. View more information ยป

    Microsoft Knowledge Base Articles:`

  • User Avatar
    0
    admin@SYNTAQ created

    Any advice on where to go from here?

    Cheers

  • User Avatar
    0
    admin@SYNTAQ created

    Further information.

    We have found that when the ConfigureServices returns the IServiceProvider namley the FalconWebMvcModule our injected controller will not work. If configureservices runs as a void our injected controller works - (but of course the rest of the system will not run).

    At the bottom are how the injected controlelr is added. It is a 3rd party spelling and grammar checker (RapidSpell).

    ` return services.AddAbp

                //Configure Log4Net logging
                options.IocManager.IocContainer.AddFacility<LoggingFacility>(
                    f => f.UseAbpLog4Net().WithConfig(_hostingEnvironment.IsDevelopment()
                        ? "log4net.config"
                        : "log4net.Production.config")
                );
    
                options.PlugInSources.AddFolder(Path.Combine(_hostingEnvironment.WebRootPath, "Plugins"), SearchOption.AllDirectories);
           
                
            });`
            
    

    services.AddControllers().AddApplicationPart(System.Reflection.Assembly.Load(new System.Reflection.AssemblyName("Keyoti.RapidSpellWeb.ASP.NET.Core")));

    We also Map the Razor pages and Controllers in the configure method

            app.UseEndpoints(endpoints =>
            {
                //endpoints.MapHub&lt;AbpCommonHub&gt;("/signalr");
                //endpoints.MapHub&lt;ChatHub&gt;("/signalr-chat");
    
                endpoints.MapRazorPages();
                endpoints.MapControllers();
    
                //endpoints.MapControllerRoute("defaultWithArea", "{area}/{controller=Home}/{action=Index}/{id?}");
                //endpoints.MapControllerRoute("default", "{controller=Home}/{action=Index}/{id?}");
    
                //if (bool.Parse(_appConfiguration["HealthChecks:HealthChecksEnabled"]))
                //{
                //    endpoints.MapHealthChecks("/health", new HealthCheckOptions()
                //    {
                //        Predicate = _ => true,
                //        ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse
                //    });
                //}
            
    
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    A more detailed error message must be in Logs.txt file under your MVC project's App_Data folder. Did you get this error message from taht file ? If not, could oyu check it and share the error message ?

    Thanks,