記錄 .NetCore3.1(ABP框架) 部署IIS後 Swagger頁面 登入按鈕邊多了個 Servers 的選項,導致登入介面URL有點問題
阿新 • • 發佈:2021-07-18
1、直接部署在網站下面不會出現 Servers 這個選項,部署到應用程式下就會出現這個東西。導致登入介面的URL錯誤。Login failed !
2、原本這樣設定了,其他的介面都能正常訪問了, 但是登入介面 Authenticate URL後還是缺少了/MyPractice 。
Startup.cs
app.UseSwaggerUI(options => { string address = _appConfiguration["App:ServerRootAddress"]; // specifying the Swagger JSON endpoint.options.SwaggerEndpoint(address.EnsureEndsWith('/')+"swagger/v1/swagger.json", "MyPractice API V1"); options.IndexStream = () => Assembly.GetExecutingAssembly() .GetManifestResourceStream("MyPractice.Web.Host.wwwroot.swagger.ui.index.html"); options.DisplayRequestDuration();// Controls the display of the request duration (in milliseconds) for "Try it out" requests. }); // URL: /swagger
appsettings.json
"App": { "ServerRootAddress": "http://118.178.191.71/MyPractice/", "ClientRootAddress": "http://118.178.191.71/MyPractice/" },
3、然後我就直接在 abp.swagger.js 這個js檔案中加上了 /MyPractice 。 臨時先這樣吧,我覺得應該可以和上面一樣寫在json 檔案中,那樣方便些。