目前参考两篇文章,已实现基本的ocelot的网关功能。

  https://www.cnblogs.com/xlxr45/p/11320988.html

  https://www.jianshu.com/p/c967eda8b04d

  按照第一篇的操作,ocelot的网关宿主为cmd,因为本想用webapi项目引用ocelot实现网关功能,配置文件有点出入。

  后来搜索查到第二篇。简单修改下配置,configuration.json 如下

{
"ReRoutes": [
{
"DownstreamPathTemplate": "/api/customers",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "localhost",
"Port":
}
],
"UpstreamPathTemplate": "/customers",
"UpstreamHttpMethod": [ "Get" ]
},
{
"DownstreamPathTemplate": "/api/customers/{id}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "localhost",
"Port":
}
],
"UpstreamPathTemplate": "/customers/{id}",
"UpstreamHttpMethod": [ "Get" ]
},
{
"DownstreamPathTemplate": "/api/products",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "localhost",
"Port":
}
],
"UpstreamPathTemplate": "/api/products",
"UpstreamHttpMethod": [ "Get" ]
}
]
}

  修改三个项目的启动宿主为iisexpress、端口等,并在解决方案中设置为多项目启动。

  VS按F5启动,可以看到同时启动三个项目

最新文章

  1. LeetCode之104. Maximum Depth of Binary Tree
  2. SpringMVC+Mybatis+Spring整合
  3. LNMP 环境发布项目
  4. centos6.5\win7双系统安装配置
  5. DSPLIB for C6455+CCSv3.3
  6. Linux设备驱动中的异步通知与异步I/O
  7. MySQL源码 数据结构hash
  8. iOS学习笔记(十四)——打电话、发短信
  9. 从JVM字节码执行看重载和重写
  10. LindDotNetCore~Polly组件对微服务场景的价值
  11. 拿到6个重磅offer的大神,超详细面试经验总结
  12. access denied for user 'root'@'localhost'(using password:YES) FOR WINDOWS
  13. 掌上电脑设备可以使用Ubuntu MATE 18.10 Linux映像了
  14. 7个Java项目,或许你的大学老师就会布置
  15. keras中的loss、optimizer、metrics
  16. Swift 内存管理
  17. 简单分页查询(web基础学习笔记十三)
  18. Problem G: 沉迷字符的WJJ (LCS)
  19. SQL注入(SQL Injection)案例和防御方案
  20. andriod 下一个页面

热门文章

  1. AWS之EC2搭建WordPress博客
  2. 笔记3:MySQL数据库
  3. 8-剑指offer: 替换空格
  4. Socket-window通讯
  5. zz先睹为快:神经网络顶会ICLR 2019论文热点分析
  6. NOIP 2012 借教室
  7. 学习input
  8. 【LG4437】[HNOI/AHOI2018]排列
  9. [LeetCode] 862. Shortest Subarray with Sum at Least K 和至少为K的最短子数组
  10. Spring Boot 知识笔记(整合Redis)