We have a combo of asp. net core odata as a back-end and Angular 6 as front-end. Both are developed separately, during each release Angular files are copied to wwwroot folder. We added these two methods to Startup.Configure to allow reading static files:
app.UseDefaultFiles();
app.UseStaticFiles();
index.html is getting hit however when Angular references it's js files in app-root element (e.g. runtime.js or polyfils.js) we get 500 error:
An unhandled exception occurred while processing the request. AmbiguousActionException: Multiple actions matched. The following actions matched route data and had all constraints satisfied: SomeNamespace.API.Controllers.ProductRequestController.GetProductRequest (SomeNamespace.API) SomeNamespace.API.Controllers.UserProfileController.GetUserProfile (SomeNamespace.API) SomeNamespace.API.Controllers.UserRoleCategoryController.GetUserRoleCategory (SomeNamespace.API) SomeNamespace.API.Controllers.WorkflowStepController.GetWorkflowStep (SomeNamespace.API) Microsoft.AspNetCore.Mvc.Internal.ActionSelector.SelectBestCandidate(RouteContext context, IReadOnlyList candidates)
It seems that even index.html gets hit other asp. net core has issues to serve other files. We also set correct (we think) base path in head:
<base href="~/">
It looks like that instead of simply serving the file app is actually trying to find proper controller (odata in this case). Does anyone have experience what is going on and what is wrong?