Ejecutar WebAPI desde VisualStudio

Esteban Andrade Cambronero 0 Reputation points
2023-02-22T20:53:59.9166667+00:00

Saludos a todos.

Recientemente cree un proyecto ASP.NET Core Web API, la aplicación se creo sin problemas junto con el ejemplo Weatherforecast. Al ejecutarlo desde VisualStudio (F5) funciona perfecto, el navegador se levanta y se muestra la interfaz de Swagger. Vi también que se asignó automáticamente un puerto, tanto para HTTP como para HTTPS, hasta aquí todo sin problemas.

En la solución necesito crear otros dos APIs y un sitio Web. Así que se me ocurrió cambiar los puertos que asignó VisualStudio al crear los proyectos. Abrí el archivo launchSettings.json y simplemente puse los puertos que quería utilizar; para mi ejemplo, en el primer proyecto, use los puertos 4000 y 4001 para HTTP y HTTPS respectivamente. El caso es que ahora, al ejecutar el proyecto, se abre el navegador pero muestra ERR_CONNECTION_RESET y el sitio no se levanta.

Yo entendí que el problema es que no se está encontrando el puerto, así que me fui a IIS y configuré un sitio web con los puertos 4000/4001 y volví a intentarlo... ahora el sitio se cargó sin problemas.

Entonces mi pregunta es, ¿cómo puedo hacer para que al cambiar los puertos, el sitio siga funcionando al presionar (F5) en VisualStudio sin necesidad de tener que configurar el IIS?

Internet Information Services
ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,307 questions
Visual Studio Debugging
Visual Studio Debugging
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Debugging: The act or process of detecting, locating, and correcting logical or syntactical errors in a program or malfunctions in hardware. In hardware contexts, the term troubleshoot is the term more frequently used, especially if the problem is major.
961 questions
Visual Studio Testing
Visual Studio Testing
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Testing: The act or process of applying tests as a means of analysis or diagnosis.
334 questions
{count} votes