ASP.NET Core:WebAppCoreApi
| ylbtech-ASP.NET Core:WebAppCoreApi |
| 1.返回顶部 |


![]() |
| 2. Controllers返回顶部 |
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)
{
}
}
}
| 3.返回顶部 |
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();
}
}
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();
}
}
}
| 4.返回顶部 |
| 5.返回顶部 |
| 6.返回顶部 |
![]() |
作者:ylbtech 出处:http://ylbtech.cnblogs.com/ 本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。 |
ASP.NET Core:WebAppCoreApi的更多相关文章
- ASP.NET Core:部署项目到Ubuntu Server
概述 基于上一篇成功安装Ubuntu Server 16.10的基础上,接下来继续我们ASP.NET Core项目的部署之旅! 只是对于这些年整天和Windows打交道的我,初次使用Linux确实有点 ...
- 实战Asp.Net Core:DI生命周期
title: 实战Asp.Net Core:DI生命周期 date: 2018-11-30 21:54:52 --- 1.前言 Asp.Net Core 默认支持 DI(依赖注入) 软件设计模式,那使 ...
- 初识ASP.NET CORE:二、优劣
Which one is right for me? ASP.NET is a mature web platform that provides all the services that you ...
- 初识ASP.NET CORE:一、HTTP pipeline
完整的http请求在asp.net framework中的处理流程: Asp.Net HttpRequest--> HTTP.exe--> inetinfo.exe(w3wp.exe)-& ...
- ASP.NET Core:CMD命令行+记事本 创建Console程序和Web Application
今天看了Scott关于ASP.NET Core的介绍视频,发现用命令行一步一步新建项目.添加Package.Restore.Build.Run 执行的实现方式,更让容易让我们了解.NET Core的运 ...
- ASP.NET Core:使用Dapper和SwaggerUI来丰富你的系统框架
一.概述 1.用VS2017创建如下图的几个.NET Standard类库,默认版本为1.4,你可以通过项目属性进行修改,最高支持到1.6,大概五月份左右会更新至2.0,API会翻倍,很期待! 排名分 ...
- 实战Asp.Net Core:部署应用
1.前言 某一刻,你已经把 .Net Core 的程序写好了.接下来,还可以做什么呢?那就是部署了. 作为一名开发工程师,如果不会部署自己开发的应用,那么这也是不完整的.接下来,我们就来说说,如何部署 ...
- ASP.NET Core:WebAppCoreReact
ylbtech-ASP.NET Core:WebAppCoreReact 1.返回顶部 1. 2. 3. 4. 5. 6. 7. 2. wwwroot 返回顶部 3. Clie ...
- ASP.NET Core:WebAppCoreRESTful
ylbtech-ASP.NET Core:WebAppCoreRESTFul 1.返回顶部 1. 2. 3. 4. 2. Controllers返回顶部 1.HomeControlle ...
随机推荐
- bzoj 2694: Lcm
2694: Lcm Time Limit: 10 Sec Memory Limit: 128 MBSubmit: 422 Solved: 220[Submit][Status][Discuss] ...
- 设计模式之装饰(Decorator)模式
设计模式之装饰(Decorator)模式 (一)什么是装饰(Decorator)模式 装饰模式,又称为包装模式,它以对客户端透明的方式扩张对象的功能,是继承关系的替代方案之一. 装饰模式可以在不使用创 ...
- linux 系统命令----修改主机名
1. hostname ***** 2.修改/etc/sysconfig/network 3./etc/hosts 最后第三步没有必要!
- win7配置java环境变量
http://jingyan.baidu.com/article/9f63fb91d87fb0c8400f0e93.html 安装JDK,从Oracel官方网站上下载,也可以通过搜索,进入链接.下载完 ...
- BUPT复试专题—数据库检索(2014软院)
题目描述 在数据库的操作过程中,我们进场会遇到检索操作.这个题目的任务是完成一些特定格式的检索,并输出符合条件的数据库中的所有结果. 我们现在有一个数据库,维护了学生的姓名(Name),性别(Sex) ...
- 进程监控模块配置与使用 ------ACE(开源项目)
下面我先从此工程的作用讲起: 此工程适用于程序异常退出,然后自动重启该程序.对于,系统重启不了该进程,那此程序将返回-1,也无法进行下一步工作. 下面,先从配置开始讲起: 参考资料:http://hi ...
- openwrt gstreamer实例学习笔记(七. gstreamer 缓冲区(Buffers)和事件(Events))
1)概述 管道的数据流由一组缓冲区和事件组成,缓冲区包括实际的管道数据,事件包括控制信息,如寻找信息和流的终止信号.所有这些数据流在运行的时候自动的流过管道. 2) 缓冲区(Buffers) 缓冲区包 ...
- 初解C#类、结构、弱引用
一.类 类中的数据和函数称为类的成员 数据成员是包含类的数据----字段.常量和事件的成员.数据成员可以是静态数据.类成员总是实例成员,除非用static进行显示的声明. 事件是类的成员,在发生某些行 ...
- notpad++快捷键
Notpad++快捷键 Notepad++选中行操作 快捷键 使用技巧 作者: Rememberautumn 分类: 其他 发布时间: 2014-09-04 14:18 阅读: 60,106 微信小 ...
- 嵌入式开发之davinci---8148/8127/8168 中dsp c674的浮点和定点兼容
c674: 是c67(浮点)+c64(定点) 兼容的 http://processors.wiki.ti.com/index.php/-mv_option_to_use_with_the_C674x ...

