ylbtech-ASP.NET Core:WebAppCoreApi
1.返回顶部
1、
2、
3、
     
   
4、
2. Controllers返回顶部
1、ValuesController.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc; namespace WebAppCoreApi.Controllers
{
[Route("api/[controller]")]
public class ValuesController : Controller
{
// GET api/values
[HttpGet]
public IEnumerable<string> Get()
{
return new string[] { "value1", "value2" };
} // GET api/values/5
[HttpGet("{id}")]
public string Get(int id)
{
return "value";
} // POST api/values
[HttpPost]
public void Post([FromBody]string value)
{
} // PUT api/values/5
[HttpPut("{id}")]
public void Put(int id, [FromBody]string value)
{
} // DELETE api/values/5
[HttpDelete("{id}")]
public void Delete(int id)
{
}
}
}
2、
3.返回顶部
1、Program.cs
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging; namespace WebAppCoreApi
{
public class Program
{
public static void Main(string[] args)
{
BuildWebHost(args).Run();
} public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.Build();
}
}
2、
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options; namespace WebAppCoreApi
{
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
} public IConfiguration Configuration { get; } // This method gets called by the runtime. Use this method to add services to the container.
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();
}
}
}
3、
4.返回顶部
 
5.返回顶部
 
 
6.返回顶部
 
作者:ylbtech
出处:http://ylbtech.cnblogs.com/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

最新文章

  1. Spring Boot中的事务管理
  2. SQL Server 参数化 PARAMETERIZATION
  3. iOS开发--录音简单实现
  4. MongoDB 副本集管理(不定时更新)
  5. ylbtech-dbs:ylbtech-4,PurpleHouse(房地产楼盘销售系统)
  6. online judge 提交代码应该注意的事项
  7. Windows 技巧
  8. GitLab 5.3 升级注意事项
  9. Java利用jcifs集成AD域用户认证
  10. 移动收入超PC端 盛大文学战略转型初见成效
  11. 【超级干货】手机移动端WEB资源整合:转载
  12. 使用DOM解析XML文件,、读取xml文件、保存xml、增加节点、修改节点属性、删除节点
  13. Asp.net MVC4高级编程学习笔记-视图学习第三课Razor页面布局20171010
  14. 文件及Linux目录结构
  15. Sql知识点总结
  16. centos mysql 修改mysql用户密码
  17. JPQL的关联查询
  18. php emoji mysql保存和搜索
  19. Storm工作流程
  20. 微服务:Java EE的拯救者还是掘墓人?

热门文章

  1. WebGIS开发之用openlayers加载离线百度地图
  2. Google代码风格配置文件(Java)(IDEA/Eclipse)
  3. 新闻:融资600万 他用一套系统优化15大HR工作场景 精简入转调离 月开通214家 | IT桔子
  4. oracle内核学习总结
  5. JS---数组(Array)处理函数整理
  6. leetCode 65.Valid Number (有效数字)
  7. async &amp; await 的前世今生(Updated)----代码demo
  8. [转载]C函数的实现(strcpy,atoi,atof,itoa,reverse)
  9. glib的安装(2)
  10. 利用NSMutableAttributedString实现label上字体大小颜色行间距的改变