摘要: 一般在webapi接口中,为了防止接口被随意调用,都会验证用户身份。 然而不能每次调用接口都需要用户输入用户名密码来验证,这时就需要授权颁发令牌了,持有令牌就可以访问接口,接口也能验证令牌身份。 简单流程 1、新建一个webapi项目,添加以下nuget包 Microsoft.Owin.Securi 阅读全文
posted @ 2019-06-23 12:09 junio.cn 阅读(386) 评论(0) 推荐(0) 编辑
摘要: 逻辑说明 这里未引用System.Web.Mvc。 主要使用MultipartMemoryStreamProvider对象从Request中获取文件流。 var provider = new MultipartMemoryStreamProvider(); await Request.Content 阅读全文
posted @ 2019-04-24 23:07 junio.cn 阅读(3106) 评论(0) 推荐(1) 编辑
摘要: 逻辑说明 webapi返回类型为IHttpActionResult接口,内部方法返回HttpResponseMessage。 public interface IHttpActionResult { Task<HttpResponseMessage> ExecuteAsync(Cancellatio 阅读全文
posted @ 2019-04-24 23:06 junio.cn 阅读(7937) 评论(0) 推荐(1) 编辑
摘要: 第一种 直接在方法中返回json。 public class DefaultController : ApiController { [HttpGet] public IHttpActionResult Now() { return Json(new { n = new Random().Next( 阅读全文
posted @ 2019-04-24 23:03 junio.cn 阅读(778) 评论(0) 推荐(0) 编辑
摘要: 下载 访问www.mysql.com 点击DOWNLOADS-->Community-->MySQL Community Server 选择要下载的版本,目前可选择的有:5.5、5.6、5.7、8.0,这里以5.7为例,所以选择的是5.7。 操作系统选择Red Hat Enterprise Linu 阅读全文
posted @ 2019-03-27 16:56 junio.cn 阅读(1865) 评论(0) 推荐(0) 编辑
摘要: 通常最小安装是没有自动启动网络连接的,可以通过ifconfig或ip addr查看网络信息 (类似windows里的ipconfig),然而最小安装是没有ifconfig命令的, 这里我们使用ip addr查看网络信息 [root@localhost ~]: ifconfig -bash: ifco 阅读全文
posted @ 2019-03-27 16:48 junio.cn 阅读(3615) 评论(0) 推荐(1) 编辑
摘要: 下载使用 访问atom.io下载Atom 这里下载的是1.33.1版本 好用的插件包 点击File->Settings->Packages,可以安装指定的插件包。 markdown-img-paste可以使用快捷键Ctrl+Shift+V粘贴剪切板中的图片, 图片会保存在md文件同级的assets目 阅读全文
posted @ 2019-03-27 16:44 junio.cn 阅读(540) 评论(0) 推荐(0) 编辑