运行Abp Vnext 微服务示例
2020-05-26 本文已影响0人
zsanhong
abp vnext的微服务https://docs.abp.io/en/abp/latest/Samples/Microservice-Demo例子是一个很好的学习dotnet的例子,然而,由于涉及的知识点太多,一直没有跑起来,最近经过一番摸索,终于把例子运行起来了,记录一下过程
一、首先从网站上下载abpvnext,我下载的是2.8版本
二、用vs2019打开,把每个工程的项目引用改为包引用。这一步很重要,因为下载的项目引用了很多abp 内部的包,如果按照以前的引用,很难编译通过
具体以AuthServer.Host项目为例,修改AuthServer.Host.csproj的内容
<ItemGroup>
<!--<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.Autofac\Volo.Abp.Autofac.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.EntityFrameworkCore.SqlServer\Volo.Abp.EntityFrameworkCore.SqlServer.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic\Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.EventBus.RabbitMQ\Volo.Abp.EventBus.RabbitMQ.csproj" />
<ProjectReference Include="..\..\..\..\modules\identity\src\Volo.Abp.Identity.Application.Contracts\Volo.Abp.Identity.Application.Contracts.csproj" />
<ProjectReference Include="..\..\..\..\modules\identity\src\Volo.Abp.Identity.EntityFrameworkCore\Volo.Abp.Identity.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\..\..\modules\identityserver\src\Volo.Abp.IdentityServer.EntityFrameworkCore\Volo.Abp.IdentityServer.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\..\..\modules\account\src\Volo.Abp.Account.Web.IdentityServer\Volo.Abp.Account.Web.IdentityServer.csproj" />
<ProjectReference Include="..\..\..\..\modules\account\src\Volo.Abp.Account.Application\Volo.Abp.Account.Application.csproj" />
<ProjectReference Include="..\..\..\..\modules\audit-logging\src\Volo.Abp.AuditLogging.EntityFrameworkCore\Volo.Abp.AuditLogging.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\..\..\modules\permission-management\src\Volo.Abp.PermissionManagement.EntityFrameworkCore\Volo.Abp.PermissionManagement.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\..\..\modules\feature-management\src\Volo.Abp.FeatureManagement.EntityFrameworkCore\Volo.Abp.FeatureManagement.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\..\..\modules\setting-management\src\Volo.Abp.SettingManagement.EntityFrameworkCore\Volo.Abp.SettingManagement.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\..\..\modules\tenant-management\src\Volo.Abp.TenantManagement.Application.Contracts\Volo.Abp.TenantManagement.Application.Contracts.csproj" />
<ProjectReference Include="..\..\..\..\modules\tenant-management\src\Volo.Abp.TenantManagement.EntityFrameworkCore\Volo.Abp.TenantManagement.EntityFrameworkCore.csproj" />-->
<PackageReference Include="Volo.Abp.Autofac" Version="2.8.0" />
<PackageReference Include="Volo.Abp.EntityFrameworkCore.SqlServer" Version="2.8.0" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic" Version="2.8.0" />
<PackageReference Include="Volo.Abp.EventBus.RabbitMQ" Version="2.8.0" />
<PackageReference Include="Volo.Abp.Identity.Application.Contracts" Version="2.8.0" />
<PackageReference Include="Volo.Abp.Identity.EntityFrameworkCore" Version="2.8.0" />
<PackageReference Include="Volo.Abp.IdentityServer.EntityFrameworkCore" Version="2.8.0" />
<PackageReference Include="Volo.Abp.Account.Web.IdentityServer" Version="2.8.0" />
<PackageReference Include="Volo.Abp.Account.Application" Version="2.8.0" />
<PackageReference Include="Volo.Abp.AuditLogging.EntityFrameworkCore" Version="2.8.0" />
<PackageReference Include="Volo.Abp.PermissionManagement.EntityFrameworkCore" Version="2.8.0" />
<PackageReference Include="Volo.Abp.FeatureManagement.EntityFrameworkCore" Version="2.8.0" />
<PackageReference Include="Volo.Abp.SettingManagement.EntityFrameworkCore" Version="2.8.0" />
<PackageReference Include="Volo.Abp.TenantManagement.Application.Contracts" Version="2.8.0" />
<PackageReference Include="Volo.Abp.TenantManagement.EntityFrameworkCore" Version="2.8.0" />
<ProjectReference Include="..\..\shared\MsDemo.Shared\MsDemo.Shared.csproj" />
</ItemGroup>
三、安装docker,具体过程请百度
四、 配置docker镜像加速器,改为阿里云镜像
{
"registry-mirrors": [
"https://你自己的阿里云.mirror.aliyuncs.com"
],
"insecure-registries": [],
"debug": true,
"experimental": false
}
如何获得自己的阿里云镜像地址,百度
五、之后的过程就比较简单,安装redis,rabbitmq,mongodb,Elasticsearch,方法大同小异
1、安装并运行redis
cmd 运行
docker pull redis
运行redis
docker run -d -p 6379:6379 --name myredis redis
2、安装并运行rabbitmq
docker pull rabbitmq:management
运行rabbitmq
docker run --name rabbitmq -d -p 15672:15672 -p 5672:5672
rabbitmq:management
3、安装mongodb
docker pull mongo
运行mongodb
docker run -p 27017:27017 -td mongo
4、安装Elasticsearch
docker pull elasticsearch
运行elasticsearch
docker run --name=test_es -d -p 9200:9200 -p 9300:9300 elasticsearch
六 安装好配套的软件后,设置解决方案的属性,按照文档的要求调整启动顺序
- AuthServer.Host
- IdentityService.Host
- TenantManagementService.Host
- BloggingService.Host
- ProductService.Host
- InternalGateway.Host
- BackendAdminAppGateway.Host
- PublicWebSiteGateway.Host
- BackendAdminApp.Host
- PublicWebSite.Host
然后Crl+F5运行
image.png image.png image.png