Make sure that the controller has a parameterless public constructor

Asked

Viewed 187 times

1

I’m getting this error after giving deploy(AWS) of my WebApi.

Note: PLACE WORKS PERFECTLY.

<ExceptionMessage> An error occurred when trying to create a controller of type 'LivroController'. Make sure that the controller has a parameterless public constructor. </ExceptionMessage>

Man controller:

public class LivroController : BaseODataController<Livro>
{
  public LivroController() : base()
    {}
}

My Base OdataController:

public class BaseODataController<TEntity> : ODataController, 
IBaseController<TEntity> where TEntity : class
{
    private readonly IRepositoryBase<TEntity> Repository;

    public BaseODataController()
    {
        Repository = new RepositoryBase<TEntity>();
    }

    [EnableQuery]
    public IList<TEntity> Get()
    {
        return Repository.Get().ToList();
    }
}

I already put an empty constructor in LivroController, but it remains the same error.

Image with complete error: inserir a descrição da imagem aqui

  • Already compared whether the local. net and AWS versions are identical?

  • 1

    Yes, I took the local tests and I went up myself.

  • Works perfectly locally published? Or works perfectly in DEBUG?

  • works perfectly when I am debugging, when I send to the server error happens

  • Tries to make a builder for Livrocontroller by calling the base: public LivroController() : base () {}

  • did not work @Gabrielcoletta, I also edited the question with the constructor, and includes an image with all the error.

  • 1

    @Vinicius Leia at all times to Inner Exception more existing internal. See that the error says: "The Provider for invariant name Mysql.Data.Mysqlclient is specified Multiple times [...]"

  • @LINQ thanks for the tip and the response here

Show 3 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.