Click here to Skip to main content
15,039,359 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a .Net 3.1 API that runs in a Docker container. I am able to do POST requests (using Postman) successfully to one of the methods but when I attempt a GET to the method below I get
Status Code: 405; Method Not Allowed

This is the method :

       public async Task<ActionResult<IEnumerable<PaymentDetailDto>>> GetAsync()
           var items = (await _service.GetAllAsync());
           return Ok(items);

What am I missing?

What I have tried:

In Startup.cs I have already added CORS:

<pre>  public void ConfigureServices(IServiceCollection services)

            services.AddDbContext<ApplicationDbContext>(o => o.UseMySql(Configuration.GetConnectionString("mysqlconnection")));
            services.AddCors(c =>
                c.AddPolicy("AllowOrigin", options => options.AllowAnyOrigin());

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900