Is it possible to create Webapi without the MVC structure?

Asked

Viewed 134 times

3

The title of the question itself defines my doubt, using VS2015 to create an API, it forces me to create the whole structure of MVC together. So I wonder if there is a way to create the API only with the Webapi structure in VS2015?

  • Are you sure it makes you? Did you cancel the MVC option? See: http://media-www-asp.azureedge.net/media/4410055/getstarted02.png. you may use what you want

  • so the Azure option allows, but the webapi option, is marked with mvc and does not allow me to uncheck wanted to understand this difference between one and another @bigown

2 answers

1

[...] using VS2015, to create an API, it forces me to create the entire MVC structure together.

No, he doesn’t make you do it. What happens is that you’re creating a project that already has a basic structure defined (template, in other words). The checkbox MVC is marked because this template uses the MVC structure, but that doesn’t mean you need to use it.

So I wonder if there is a way to create the API only with the Webapi structure in VS2015?

Yes, exists. Instead of choosing the template Webapi by clicking on new ASP.NET project, select the Empty and check the checkbox Webapi. All required dependencies will be downloaded and no dependency MVC will be added.

Escolher tipo do projeto

See which dependencies have been added

Dependências instaladas

0

It is possible yes.

Visual Studio has a template on New -> web site -> ASP.NET Web Service.

It is not necessary to use the MVC standard for this, although it is a good recommendation.

In the first link there is a tutorial step by step if you want: Web Service C#

Browser other questions tagged

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