0

I have looked at quite a few articles here, but none of them seem to be suitable for my case. If it helps or pertains to the issue, I am using ninjectMVC for dependency injection.

I have an Angular $http as such:

$http({
    method: 'POST',
    url: '/Lookup/GetChangeOptions/'
}).success(function (data) {
    console.log(data);
    var test = data;
    //$scope.changeOptions = data;
}).error(function (jqXhr, textStatus, errorThrown) {
    console.log(errorThrown);
});

Which calls my controller:

public class LookupController : Controller
{
    private readonly ILookupService _lookupService;

    public LookupController(ILookupService lookupService)
    {
        _lookupService = lookupService;
    }

    public JsonResult GetOtherIssues()
    {
        var otherIssues = _lookupService.GetOtherIssues();

        return Json(otherIssues);
    }

    public JsonResult GetChangeOptions()
    {
        var changeOptions = _lookupService.GetChangeOptions();

        return Json(changeOptions);
    }
}

The call is giving me the error:

"System.MissingMethodException: No parameterless constructor defined for this object."

I am not sure what is causing the issue.. I have used similar structures in the past without any problems. Please let me know if I need to put the code of my service, but when I debug the call.. my break point in the controller is not even hit.

3
  • 2
    is your ioc container properly registered? Commented Jun 17, 2014 at 0:28
  • 1
    stackoverflow.com/questions/1355464/… Commented Jun 17, 2014 at 0:28
  • That was it, such a stupid mistake. Thanks a lot boss. Because of a previous issue, i had excluded the IOC initialization from the project and forgot to add it back again. Could you post this in a new post, so I can mark it as the answer :-) Commented Jun 17, 2014 at 0:41

1 Answer 1

1

Ensure your IoC container is still resolving.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.