When testing my web C # ASP.NET locally in Fiddler it returns me a 404 error

0

I'm creating a stock control system with android application integration, the connection is being made through a Web Service API. However I can not test the methods that exist in it to see the results returned, I'm using Fiddler but every time I call the url it returns me the 404 not found error. The programming language used is C # and I'm using ASP.NET 4.6.

Thank you in advance. Please if anyone has clues or deeper understanding I accept urgent help.

Below are the Project Explorer Screenshots, Fiddler Error as well as some Codes

Controller:

using System;
using APITeste.Models;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;

namespace APITeste.Controllers
{
    public class PessoaController1 : ApiController
    {
        private static List<Models.Pessoa> _pessoas = new List<Models.Pessoa>();
        // GET: api/Pessoa
        public IEnumerable<Models.Pessoa> Get()
        {
            return _pessoas;
        }

        // GET: api/Pessoa/5
        public Models.Pessoa Get(int id)
        {
            return _pessoas.FirstOrDefault(pessoa => pessoa.ID.Equals(id));
        }

        // POST: api/Pessoa
        public void Post([FromBody]Models.Pessoa value)
        {
            _pessoas.Add(value);
        }

        // PUT: api/Pessoa/5
        public void Put(int id, Models.Pessoa value)
        {
            var pessoa = Get(id);
            if (pessoa != null)
            {
                pessoa.Nome = value.Nome;
                pessoa.Sobrenome = value.Sobrenome;
            }
        }

        // DELETE: api/Pessoa/5
        public void Delete(int id)
        {
            var pessoa = Get(id);
            if (pessoa != null)
                _pessoas.Remove(pessoa);
        }
    }
}

Model:

namespace APITeste.Models
{
    public class Pessoa
    {
        public int ID { get; set; }
        public string Nome { get; set; }
        public string Sobrenome { get; set; }
    }
}

Fiddler Debugger:

SolutionExplorer:

    
asked by anonymous 01.12.2016 / 21:05

1 answer

1

This happens because the controller person is named PessoaController1 .

Controllers need only have Controller at the end of the name.

Rename the PessoaController1 class to PessoaController .

Note: Renaming the class, the file is indifferent.

    
01.12.2016 / 21:23