> For the complete documentation index, see [llms.txt](https://abi.gitbook.io/net-core/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://abi.gitbook.io/net-core/4.-creando-tu-primer-servicio/4.3-creando-el-servicio.md).

# 4.3 Creando el servicio Categorias

En .Net Core los servicios se crean en las clases Controller, Visual Studio te genera automáticamente el código necesario en base a tu modelo. Para esto sigue los siguientes pasos:

1. Da clic con el botón derecho de mouse sobre la carpeta Controller. Luego da clic en **Agregar -> Nuevo elemento con scaffold...**

![](/files/-LOM--3JoiXU4x3cedP8)

2\. Seleccionamos la opción **Controlador de API con acciones que usan Entity Framework** y damos clic en el botón **Agregar**

![](/files/-LOM-Yx1V0N3haGTN5ZB)

3\. En Clase de Modelo seleccionamos nuestra clase **Categoria**.

En la Clase de contexto de datos seleccionamos **CaducaContext.**\
Revisamos el Nombre de controlador, por lo general es el nombre de la tabla mas una s, mas a veces agrega es.

Por último damos clic en **Agregar.**

Esperamos un momento para que instale los paquetes Nuget faltantes y que genere el código del controlador. Dentro de la carpeta Controllers te creará el archivo CategoriasControlller con las operaciones básicas de los servicios REST.&#x20;

![](/files/-LOM0HtJOE5Oso-URyTT)

Podemos correr la aplicación y podemos probar el servicio. Puedes probar el método get directamente en el navegador, en mi caso como tengo el proyecto para utilizar IISExpress se corre en el puerto 50685 este puerto es aletorio, en tu proyecto puede ser otro puerto. Mas adelante se explicará como configurar tu proyecto para que corra en algún puerto especifico.

<http://localhost:50685/api/Categorias>

###


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://abi.gitbook.io/net-core/4.-creando-tu-primer-servicio/4.3-creando-el-servicio.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
