I am following this tutorial: http://www.asp.net/vnext/overview/aspnet-vnext/create-a-web-api-with-mvc-6 to setup a web api and I have not made it very far. Once I added the line: services.addMvc();
I got an exception saying this method is not found. I searched online and found a separate question/answer here: http://forums.asp.net/t/2026087.aspx but that did not help.
My startup.cs looks like this:
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
}
public void Configure(IApplicationBuilder app)
{
app.UseMvc();
app.UseWelcomePage();
}
And my project.json:
{
"webroot": "wwwroot",
"version": "1.0.0-*",
"exclude": [
"wwwroot"
],
"packExclude": [
"node_modules",
"bower_components",
"**.kproj",
"**.user",
"**.vspscc"
],
"dependencies": {
"Microsoft.AspNet.Server.IIS": "1.0.0-beta2",
"Microsoft.AspNet.Diagnostics": "1.0.0-beta1",
"Microsoft.AspNet.Mvc": "6.0.0-beta1"
},
"frameworks" : {
"aspnet50" : { },
"aspnetcore50" : { }
}
}
Mostly sure you are using some incorrect packages. Try to create the default starter application that comes with VS (use the latest VS 2015) and see exactly what packages to use.
A few comments based on the contents of yourproject.json
file:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With