Angular - Troubleshooting - FirstRun - 405

405

Angular had

1
2
3
updateAgency(agency: Agency):  Observable<Result<Agency>> {
return this.http.put<Result<Agency>>(`${this.apiUrl}${id}`,agency);
}

C# had

1
2
3
4
5
6
7
8
9
10
[HttpPut]
public IActionResult Put([FromBody] AgencyViewModel agencyViewModel)
{
if (!ModelState.IsValid)
return BadRequest(ModelState);

var result = _agencyService.UpdateAgency(agencyViewModel, GetIpAddress());
return ReturnResult(result);

}

Notice – it didn’t have an argument for ID.

When I changed Angular to

1
2
3
updateAgency(agency: Agency):  Observable<Result<Agency>> {
return this.http.put<Result<Agency>>(this.apiUrl,agency);
}

The problem went away

An unhandled exception occurred while processing the request.
InvalidOperationException: Unable to resolve service for type ‘RCTS.Shared.Interfaces.IReminderDayRepository’ while attempting to activate ‘RCTS.Services.RequirementService’.
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateArgumentCallSites(Type serviceType, Type implementationType, CallSiteChain callSiteChain, ParameterInfo[] parameters, bool throwIfCallSiteNotFound)

Stack Query Cookies Headers
InvalidOperationException: Unable to resolve service for type ‘RCTS.Shared.Interfaces.IReminderDayRepository’ while attempting to activate ‘RCTS.Services.RequirementService’.
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateArgumentCallSites(Type serviceType, Type implementationType, CallSiteChain callSiteChain, ParameterInfo[] parameters, bool throwIfCallSiteNotFound)
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateConstructorCallSite(Type serviceType, Type implementationType, CallSiteChain callSiteChain)
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.TryCreateExact(ServiceDescriptor descriptor, Type serviceType, CallSiteChain callSiteChain)
:

This was fixed by adding the following statement

1
services.AddScoped<IReminderDayRepository, ReminderDayRepository>();

References

Return to angular [[FirstRunErrors]] page.