I'm working on .NET core web API and I wanted to integrate the project with Swagger.
I have followed all the steps in this article https://dev.to/amoenus/how-to-integrate-swagger-ui-in-a-net-core-web-api-application-amoenus-dev-13o1
Now the project is not running on IIS , So to navigate to swagger I typed http://localhost:8080/swagger.
Because I have this in StartUp
app.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API");
c.RoutePrefix = string.Empty;
});
And honestly I assumed the port is 8080 because I don't know what is my port.
Can someone tell me if I can have swagger if i'm not running on IIS and how to know exactly my localhost port?
Settings are in launchSettings.json and it is under Properties folder in web api root. Below is sample from my settings.
"profiles": {
"test-web-api": {
"commandName": "Project",
"dotnetRunMessages": "true",
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "local"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "local"
},
"use64Bit": true
}
}