Configuring DynamicApiControllerBuilder
See original GitHub issueHi All,
I’m trying to setup an application from ASP.NET Boilerplate Templates. I’ve chosen ASP.NET Core 1.0 which is not actually pure ASP.NET Core because it uses .Net Framework 4.6.1. An app which is just installed works fine, however, I want to replace ASP.NET MVC with ASP.NET WebAPI. Any of my attempts led me to error 404. Please advise, what am I doing wrong?
My changes were:
- Extending of Application layer with a trivial Service.
public interface IAccountAppService : IApplicationService
{
Task<string> GetAllAccounts();
}
public class AccountAppService : CrmAppServiceBase, IAccountAppService
{
public async Task<string> GetAllAccounts()
{
return await Task.Run(() => "Hello world!");
}
}
- Adding a reference to the Abp.Web.Api package for the Crm.Web project.
- Updating the PreInitialize() method like as below:
public override void PreInitialize()
{
Configuration.DefaultNameOrConnectionString = _appConfiguration.GetConnectionString(CrmConsts.ConnectionStringName);
Configuration.Navigation.Providers.Add<CrmNavigationProvider>();
Configuration.Modules.AbpAspNetCore()
.CreateControllersForAppServices(
typeof(CrmApplicationModule).Assembly
);
DynamicApiControllerBuilder
.ForAll<IApplicationService>(Assembly.GetAssembly(typeof(CrmApplicationModule)), "crm")
.WithConventionalVerbs()
.Build();
}
- Running the application and trying to access Api action by navigating to http://localhost:62114/api/services/crm/account/GetAllAccounts
Issue Analytics
- State:
- Created 7 years ago
- Comments:12 (7 by maintainers)
Top Results From Across the Web
Building Dynamic Web API Controllers
This configuration should be made in the Initialize method of your module. ... DynamicApiControllerBuilder provides a method to build web api controllers ...
Read more >Building Dynamic Web API Controllers
In this code, we created dynamic web api controllers for all application services in an assembly. Then overrided configuration for a single application ......
Read more >Dynamic Web API Controllers and WithConventionalVerbs()
I'm using Dynamic Web API Controllers but my Get methods are being ... Configuration.Modules.AbpWebApi().DynamicApiControllerBuilder .
Read more >How to configure dynamic API for multiple module #2063
Hello dears We are building a project that we want to have in modules. Like a module for 'blog', 'sales', 'accounting', .
Read more >Using boilerplate with a REST api #2623
Configuration.Modules.AbpWebApi().DynamicApiControllerBuilder.For("tasksystem/task").Build();. Is that it or is there anything else I need ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I had just to use
instead of
since I’m using ASP.NET Core project.
Thanks!
Yes, AspNet Core replaces all of them.