如何在 IIS中托管此
C:\kk\AngularTypeScript\publish
|-- Backend.deps.json
|-- Backend.dll
|-- Backend.exe
|-- Backend.runtimeconfig.json
|-- Microsoft.OpenApi.dll
|-- Swashbuckle.AspNetCore.Swagger.dll
|-- Swashbuckle.AspNetCore.SwaggerGen.dll
|-- Swashbuckle.AspNetCore.SwaggerUI.dll
|-- appsettings.Development.json
|-- appsettings.json
|-- web.config
`-- wwwroot
|-- 3rdpartylicenses.txt
|-- favicon.ico
|-- index.html
|-- main.e3e89bda804b4330.js
|-- polyfills.69ca295dd26cc35d.js
|-- runtime.f8659de94caf0803.js
`-- styles.ef46db3751d8e999.css

uj5u.com熱心網友回復:
我的建議是按照微軟的教程一起發布,至于你得到的404錯誤,檢查你是否安裝了url rewrite,如果沒有,安裝它。

我將我的專案命名為 Backend,這就是為什么您會看到 Backend.dll(您需要相應地更改它)。此外,您將看到授權部分。
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\Backend.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
</system.webServer>
</location>
<system.webServer>
<security>
<authorization>
<add accessType="Allow" users="*" />
</authorization>
</security>
</system.webServer>
</configuration>
由于我已經有一個系結到埠 80 的網站,我將這個站點系結到埠 83。
在您的瀏覽器中,轉到
http://localhost:83 查看 Angular 站點加載(使用來自后端 Web API 的資料)

http://localhost:83/weatherforecast 查看來自 WEB API 控制器的 JSON 回應。

在 IIS 中托管 ASP.NET Core 還有其他必要步驟,但這些步驟并不特定于這個問題。
希望這對其他人有幫助!
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/515104.html
