里约大冒险迅雷下载,保普选反占中什么意思,段黄巍呛口小辣椒
图文说明,注意流量.
建好之后就像下面这样
core类库项目分别是 apistudy.core
和 apistudy.infrastructure
一个解决方案下三个项目:
startup
类代码namespace apistudy.api { using microsoft.aspnetcore.builder; using microsoft.aspnetcore.hosting; using microsoft.extensions.dependencyinjection; public class startup { // this method gets called by the runtime. use this method to add services to the container. // for more information on how to configure your application, visit https://go.microsoft.com/fwlink/?linkid=398940 public void configureservices(iservicecollection services) { services.addmvc(); } // this method gets called by the runtime. use this method to configure the http request pipeline. public void configure(iapplicationbuilder app, ihostingenvironment env) { if (env.isdevelopment()) { app.usedeveloperexceptionpage(); } app.usemvc(); //使用默认路由 } } }
用来向容器中注册服务,注册好的服务可以在其他地方进行调用.
用来配置中间件管道,即如何响应http请求.
代码如下:
namespace apistudy.api.controllers { using microsoft.aspnetcore.mvc; [route("api/[controller]")] [apicontroller] public class usercontroller:controller { public iactionresult get() { return ok("hello"); } } }
修改lauchsetting.json如下:
{ "profiles": { "apistudy.api": { "commandname": "project", "launchbrowser": true, "applicationurl": "https://localhost:5001;http://www.lhsxpumps.com/_localhost:5000", "environmentvariables": { "aspnetcore_environment": "development" } } } }
浏览器访问 https://localhost:5001/api/user
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
Net Core Web Api项目与在NginX下发布的方法
asp.net core3.1 引用的元包dll版本兼容性问题解决方案
IdentityServer4实现.Net Core API接口权限认证(快速入门)
ASP.NET Core MVC通过IViewLocationExpander扩展视图搜索路径的实现
网友评论