Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Application Services as Controllers -> useConventionalHttpVerbs #12156


User avatar
0
dominici created

Dear support, I'm migrating an old AspNetZero Net Framework + AngularJs app to version 13.2 (Net Core 8 + Angular v 17 )

At the time the useConventionalHttpVerbs were false by default, now the default it's true

To maintain the most compatibility as possible, I would change this parameter also on the new version but I have some questions: 1 - If I change the parameter to false, the Angular v 17 project will continue to work? 2 - Is it possible to use the useConventionalHttpVerbs = false only for my application services without changing method names or adding httpattributes to every single mathod?

Thanks in advance

Br, Fabrizio


4 Answer(s)
  • User Avatar
    0
    m.aliozkaya created
    Support Team

    Hi @dominici,

    If you use useConventionalHttpVerbs = false, some things may not work as expected. But since it will be a Post method by default, I don't think it will cause too many problems.

    You can check this document for more information. https://aspnetboilerplate.com/Pages/Documents/AspNet-Core#application-services-as-controllers

  • User Avatar
    0
    dominici created

    Hi m.aliozkaya, I'm going a little deep in analysis and, changing the parameter to useConventionalHttpVerbs = false, a lot of methods (starting from the boostrap phase) doesn't work on the angular application. Not only "some things may not work as expected"

    You can check this document for more information. https://aspnetboilerplate.com/Pages/Documents/AspNet-Core#application-services-as-controllers

    I red many time the documentation and I also searched in the forum before asking but no side-effects it's mentioned changing this parameter.

    Since AspNetZero is a paid product and support is part of the services, I would have expected a more precise, technical and detailed answer

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @dominici

    We don' suggest setting useConventionalHttpVerbs = false. If you are going to use Angular as your client app, we are using NSWAG and it will auto-generate client proxy classes for you.

  • User Avatar
    0
    dominici created

    Hi @ismcagdas, I found a solution by myself

    I created a dedicated interface for my custom application services and another interface for the app services provided by asp net zero template.

    Then, in the MyAppWebCoreModule.cs I wrote:

                Configuration.Modules.AbpAspNetCore()
                    .CreateControllersForAppServices(
                        typeof(MyAppApplicationModule).GetAssembly(), useConventionalHttpVerbs: true
                    ).Where(type => typeof(IAspNetZeroBaseAppService).IsAssignableFrom(type));
    
                Configuration.Modules.AbpAspNetCore()
                    .CreateControllersForAppServices(
                        typeof(MyAppApplicationModule).GetAssembly(), useConventionalHttpVerbs: false
                    ).Where(type => typeof(IMyAppBaseAppService).IsAssignableFrom(type));
    

    By this way I can force the HttpPost on all my custom services (as the very old version of AspNetZero) and at the same time I can maintain the conventional verbs for the Angular part included in the new Asp Net Zero template

    I hope this helps

    Br, Fabrizio