0
votes

I wanted to quickly try setting up a web api in Visual Studion 2013. Created Web API project (fine). Set reference through EF to my backend DB (ok)

Then read about something called 6.x DbContext Generator where it says you should be using it. 2 Hours later still not sure what this Generator does. But worked out I had to delete a few tt files before it would run on existing edmx page.

So now all ready right ?

Run up project and get the OWIN error. The following errors occurred while attempting to load the app.

  • No assembly found containing an OwinStartupAttribute.
  • No assembly found containing a Startup or [AssemblyName].Startup class.

To disable OWIN startup discovery, add the appSetting owin:AutomaticAppStartup with a value of "false" in your web.config.

Never heard of OWIN till then. Don't know what it is why it needs to be there. However, the instruction to disable OWIN by placing a key int he config file (both as there are two in a web API) has no affect.

Then I read that I should be using MVC 6.0 which has no web api and some different form of OWIN. But its not here yet.

So my question is. If I want to set up a web api quickl, how should I go about doing this so I can get past all these issues ?

1
For just web api, open a new project and in the web application template, choose empty and then select only the WebApi check box. This will not bring in any Owin dependenciesXtremeBytes

1 Answers

0
votes

For creating purely Web Api project, always go for "Empty Template" with Folder and core references for "Web API" as shown here

Empty ASP.NET with Web API

Then using Nuget, download EF 6.x version, for EF either use model first, code first approach.

Use EF tools for reverse engineer existing database, if your creating fresh database follow Code First approach it will help understand EF better(I felt it)

Above steps will help quickly start Web API with EF and of course OWIN is no where required.

MVC 6 is still beta, it's significant change in web apps development.