美文网首页
ABP分层部署遇到的问题及解决办法

ABP分层部署遇到的问题及解决办法

作者: 寻找无名的特质 | 来源:发表于2021-10-26 05:37 被阅读0次

今天尝试ABP项目的分层解决方案,也就是将认证服务、Api服务和Web服务器分开。在调试环境下运行没有问题:首先启动Redis服务,然后将三个应用分别启动,可以正常工作。这里附带说一下,如果不启动Redis服务,运行会非常之慢。可是生成部署文件,在部署环境下测试遇到问题。我修改了认证服务器、Api服务器和Web服务器的IP地址,并在配置文件中进行了修改:
认证服务器的appsettings.json:

{
  "App": {
    "SelfUrl": "https://localhost:5555",
    "ClientUrl": "http://localhost:4200",
    "CorsOrigins": "https://*.HelpDesk.com,https://localhost:5550,http://localhost:4200,https://localhost:44307,https://localhost:44397",
    "RedirectAllowedUrls": "https://localhost:4200,https://localhost:44307"
  },
  "ConnectionStrings": {
    "Default": "Server=localhost;Port=3306;Database=HelpDesk;Uid=root;Pwd=1q2w3e4R*;"
  },
  "Redis": {
    "Configuration": "127.0.0.1"
  },
  "StringEncryption": {
    "DefaultPassPhrase": "pR6ZmekSA8glEAMc"
  },
  "server.urls": "https://0.0.0.0:5555"
}

Api服务器的appsettings.json:

{
  "App": {
    "CorsOrigins": "https://*.HelpDesk.com"
  },
  "ConnectionStrings": {
    "Default": "Server=localhost;Port=3306;Database=HelpDesk;Uid=root;Pwd=1q2w3e4R*;"
  },
  "Redis": {
    "Configuration": "127.0.0.1"
  },
  "AuthServer": {
    "Authority": "https://localhost:5555",
    "RequireHttpsMetadata": "true",
    "SwaggerClientId": "HelpDesk_Swagger",
    "SwaggerClientSecret": "1q2w3e*"
  },
  "StringEncryption": {
    "DefaultPassPhrase": "pR6ZmekSA8glEAMc"
  },
  "server.urls":"https://0.0.0.0:5550"
}

Web 服务器appsettings.json

{
  "App": {
    "SelfUrl": "https://localhost:41234"
  },
  "RemoteServices": {
    "Default": {
      "BaseUrl": "https://localhost:5550/"
    }
  },
  "Redis": {
    "Configuration": "127.0.0.1"
  },
  "AuthServer": {
    "Authority": "https://localhost:5555",
    "RequireHttpsMetadata": "true",
    "ClientId": "HelpDesk_Web",
    "ClientSecret": "1q2w3e*"
  },
  "StringEncryption": {
    "DefaultPassPhrase": "pR6ZmekSA8glEAMc"
  },
  "server.urls":"https://0.0.0.0:41234"
}

,启动似乎没有问题,但认证出现问题,无法显示登录页面,查看认证服务器的日志,发现如下记录:

2021-10-22 14:42:19.182 +08:00 [INF] {"ClientId":"HelpDesk_Web","ClientName":"HelpDesk_Web","RedirectUri":null,"AllowedRedirectUris":["https://localhost:44304/signin-oidc"],

发现Web服务注册的地址仍然是调试环境下的https://localhost:44304/,而不是修改后的https://localhost:41234。原来这部分信息是保存在数据库中的:

图片.png
图片.png
使用sql语句在数据库中修改相应的数据,然后重新启动redis和其它服务,可以正常工作了。
后来发现,ABP的商业模块中带有认证服务的维护界面,需要付费。

相关文章

网友评论

      本文标题:ABP分层部署遇到的问题及解决办法

      本文链接:https://www.haomeiwen.com/subject/ehacaltx.html