I'm learning dotnet core 2.1 SPA, and when I run the donet core 2.1 SPA Angular
with dotnet run
, I noticed that there are 3 differnt ports:
https:localhost:5001
http:localhost:5000
http:localhost:34941
When I use the second url, it just automatically redirect to the first url, and I got security error. For the 3rd url, it works. I think because it's for the client, where 1st and 2nd url would be used for APIs calls with authentications? What would happen in a live environment?
The configuration in Program.cs file
public class Program
{
public static void Main(string[] args)
{
CreateWebHostBuilder(args).Build().Run();
}
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>();
}
"Just porting to .NET Core because it's a new .NET implementation isn't a good enough reason (unless you're a True Fan). ".NET Core is optimized for building highly scalable web applications, running on Windows, macOS or Linux. If you're building Windows desktop applications, then the .NET Framework is the best choice for you.
ASP.NET Core 2.0 recently released and, with it, came some new templates, including new project templates for single-page applications (SPA) served from an ASP.NET Core backend. These templates make it easy to setup a web application with a rich JavaScript frontend and powerful ASP.NET Core backend.
Scenarios for .NET Core Today, four scenarios exist in which you can write code for .NET Core: cross-platform ASP.NET Web apps, cross-platform console apps, cross-platform libraries and frameworks, and UWP apps Built for speed, ASP.NET Core 1.0 is the cross-platform Web stack for .NET Core.
Updating from .NET Core 3.1 to .NET 6+ requires much less effort than porting from .NET Framework to .NET Core. For this reason, many customers may choose to upgrade to .NET Core 3.1 first as an incremental step, and then further upgrade to .NET 6 once the upgrade to .NET Core 3.1 has succeeded.
5000 is for HTTP and 5001 is for HTTPS. Those are defaults in the ASP.NET Core Kestrel Server. 5000 redirects to 5001 because of app.UseHttpsRedirection()
in your Startup class.
This is an arbitrary, available port that Microsoft.AspNetCore.SpaServices
uses to start the NG Live Development Server. The spa.UseAngularCliServer(npmScript: "start")
method in your Startup class calls the the start
script from your package.json
file like this:
ng serve --extract-css "--port" "50415"`
The port that it passes is any currently available port that the SpaServices
find.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With