.netasp.net-core-webapi.net-6.0

Main solution url cannot hit my other solutions controller


I have 3 different solutions running (main, letter and member), but everything needs to be accessible by the main projects url, the letter one works when I am running the project from the main url port but for some reason my member one doesn't work, it only works on the port number it is running on.

My main url is localhost:7127 and it works for hitting my letter controller even tho it starts on a different port, but for my member it only hits on it's own url https://localhost:7207

I have tried changing the Program files to allow from multiple different hosts but it just doesn't want to work, here is what I tried and was the difference between my letter and member but no prevail, is this even a Porgam.cs issue or am I going down the wrong rabbit hole ?

Main

builder.Services.AddCors(options =>
{
    options.AddPolicy("AllowAll", policy =>
    {
        policy.AllowAnyOrigin()
              .AllowAnyMethod()
              .AllowAnyHeader();
    });
});

Here are my postman calls as well

https://localhost:7127/api/member is a get call and is giving me a 500 error

Unable to resolve service for type 'Member.Services.FormService' while attempting to activate 'Member.API.Controllers.MemberFormController'.

but when I ran this https://localhost:7207/api/member then it works, so I need it to run on that 7127 port and I cannot figure out why it is not running there


Solution

  • So I tried every suggestion and I basically did dependency injection wrong and I just went and re-did everything and got it to work, I tried making a generic services for type T and having a generic database repo and I think that I did not do it properly