-1
I’m creating an API project in dotnet core and I’m not being able to perform requests via postaman on it.
Urls of attempts:
"http://localhost:5050 e http://0.0.0.0:5050"
"https://localhost:5001 e https://0.0.0.0:5001"
"http://localhost:5000 e http://0.0.0.0:5000"
Request:
{
"UserName": "testeteste",
"Name": "Teste Teste",
"Email": "[email protected]",
"Password": "Teste1234",
"Password2": "Teste1234"
}
Repository: https://github.com/nicolabogar/Aplicacao-Gerenciar-Senhas
I set up a URL "http://0.0.0.0:5050"
standard in Program.Cs
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseUrls("http://0.0.0.0:5050");
webBuilder.UseStartup<Startup>();
webBuilder.UseIISIntegration();
})
.UseContentRoot(Directory.GetCurrentDirectory())
.ConfigureAppConfiguration((builder, configuration) =>
{
configuration.Sources.Clear();
configuration.SetBasePath(Environment.CurrentDirectory);
configuration.AddJsonFile("appsettings.json", true, true);
});
}
I performed the appropriate settings in the Startup class
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
public void ConfigureServices(IServiceCollection services)
{
services.AddAppSettings(Configuration);
services.AddControllers();
services.AddSingletons();
services.AddScopes();
services.AddEntityFramework();
services.AddAuthenticationJwt();
services.AddLogging((config) =>
{
config.AddDebug();
config.AddConsole();
});
services.AddMvc();
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseHttpsRedirection();
app.UseRouting();
//app.UseAuthorization();
//app.UseAuthentication();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});
}
}