素材巴巴 > 程序开发 >

iis swagger 部署_关于部署:如何将ABP部署到IIS

程序开发 2023-09-03 14:28:10

我有一个ABP模板。它是Full .Net框架中Angular的合并解决方案。我已经通过右键单击Web.Host项目,然后单击"发布"来创建发布的程序包。

这是我发布的文件夹的屏幕截图:

73dfc97814e594e2db77a1d475414cf7.png

我还在本地IIS中添加了一个网站,并将其指向发布文件夹的wwwroot文件夹,即localhost:8081。

我将wwwroot/assets文件夹中的appconfig.json修改为:

{

"remoteServiceBaseUrl":"http://localhost:8081",

"appBaseUrl":"http://localhost:8081"

}

并将appsettings.json更改为

"App": {

"ServerRootAddress":"http://localhost:8081/",

"ClientRootAddress":"http://localhost:8081/",

"CorsOrigins":"http://localhost:8081,http://localhost:8081"

},

我是否需要在IIS中为主机添加另一个网站?如果是,我应该指向哪里?再次wwwroot?所有DLL和appsettings.json都位于wwwroot之上。我应该把它们都带进wwwroot吗?

导航到localhost:8081时,出现"找不到资源"提示

我注意到发布文件夹中有一个Web.Host.exe文件。将以上所有设置更改为localhost:5000并执行时,它将在localhost:5000上运行主机,并且对于localhost:5000/swagger和localhost:5000/app/均能正常工作

我是否需要在IIS下的网站来执行Web.Host.exe?如果可以,我将如何添加此类网站?为.exe文件设置了哪个端口5000?

如果将网站物理文件夹更改为已发布文件夹(包含wwwroot文件夹),则会出现以下错误(似乎web.config文件有问题):

6c3ab447097bd07719f660d067d8304c.png

您需要.NET Core Hosting Bundle。

Install the .NET Core Hosting Bundle on the hosting system. ...

a. Navigate to the .NET All Downloads page.

b. Select the latest non-preview .NET Core runtime from the list (.NET Core > Runtime > .NET Core Runtime x.y.z). ...

c. On the .NET Core runtime download page under Windows, select the Hosting Bundle Installer link to download the .NET Core Hosting Bundle.

...

Restart the system or execute net stop was /y followed by net start w3svc from a command prompt. Restarting IIS picks up a change to the system PATH made by the installer.

参考:https://docs.microsoft.com/zh-cn/aspnet/core/publishing/iis?tabs=aspnetcore2x

亚伦,非常感谢您的评论。 它解决了问题! 但是我有点困惑! 当我的目标框架是Full .Net framework时,为什么需要安装.Net Core。 我以为只有在我的项目是Asp Core时才需要它!

您的项目是ASP.NET Core。 请参阅.NET Core与ASP.NET Core。


标签:

素材巴巴 Copyright © 2013-2021 http://www.sucaibaba.com/. Some Rights Reserved. 备案号:备案中。