(2) Micro-service Micro-service----. Netcore boot Configuration and. Netcorewebapi

Source: Internet
Author: User
Tags dotnet

What is. Net Core?
. NET core is another Microsoft-developed. NET that can span Linux, Windows, Macs, and other platforms.
. Net core related knowledge look at the article to the point
dotnet Dllname.dll Run
PostMan is a very professional tool for debugging WEBAPI

ASP. NET Core Configuration

Setting the boot port

CMD--Set aspnetcore_urls=http://127.0.0.1:8080 (reading this configuration in the program is difficult)


modifying ports through code
The Createwebhostbuilder (. NET core 2.1)/Createdefaultbuilder (. NET Core 2.0) method under program is the last. Userurls ("http://127.0.0.1:9999"); (Written dead)


Setting up a boot port with a command configuration
Modify the Createwebhostbuilder (. NET core 2.1)/Createdefaultbuilder (. NET Core 2.0) method under Program
Gets the IP and port number that is passed in the cmd command.
var config = new Configurationbuilder (). Addcommandline (args). Build ();
String IP = config["IP"];
String prot = config["Port"];
In the end. Useurls ($ "http://{ip}:{port}");
Call cmd, dotnet name.dll--ip 127.0.0.1--port 8888

----------
Webapi is a restful style, the request response is preferably in JSON format

. Netcore Webapi and MVC became the same controller's parent class. NET is not much different from the use of

Error by status code instead of response body, is restful style

. Net Core Related Materials
https://windsting.github.io/little-aspnetcore-book/book/
Https://docs.microsoft.com/zh-cn/aspnet/core/
. Net Core WebApi
https://docs.microsoft.com/zh-cn/aspnet/core/web-api/?view=aspnetcore-2.1

(2) Micro-service Micro-service----. Netcore boot Configuration and. Netcorewebapi

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.