[英]Deploying ASP.NET Core App to Azure results in blank pages
我有一個免費的 Azure 帳戶。 我有一個 ASP.NET Core MVC 項目,致力於 GitHub,我在 Visual Studio for Mac build 8.10.23(社區)上用 C# 開發了該項目。 在本地運行時一切正常。 我想將它部署到 Azure,因此它可以公開用於測試。
我已經設置了從我的 GitHub 帳戶到我的 Azure 應用程序的持續集成。 每當我提交時,構建和部署過程都會運行並成功。
問題:當我訪問我的應用程序 URL 時,我只得到空白頁。 就好像視圖不會呈現。 我可以訪問 /wwwroot 中的文件(通過手動輸入網站 URL 和 /img/intro.png 之類的內容)並顯示它們,因此我知道 Web 服務器正在提供文件。 但似乎 ASP.NET Core 運行不正常,而且我在 Kudu 中看不到任何錯誤。
網站網址: https ://legendary-mud.azurewebsites.net/ GitHub 網址: https ://github.com/Usualdosage/Legendary
任何想法都非常感謝。
出現這個問題的原因是你的中間件在pipline中沒有next方法,被中斷了。
您需要更改Server.cs
文件,如下所示。
// <copyright file="Server.cs" company="Legendary">
// Copyright © 2021 Legendary
// All rights are reserved. Reproduction or transmission in whole or
// in part, in any form or by any means, electronic, mechanical or
// otherwise, is prohibited without the prior written consent of
// the copyright owner.
// </copyright>
namespace Legendary.Networking
{
using System.Threading.Tasks;
using Legendary.Core.Contracts;
using Legendary.Data.Contracts;
using Legendary.Engine.Contracts;
using Legendary.Networking.Contracts;
using Microsoft.AspNetCore.Http;
/// <summary>
/// Server concrete implementation.
/// </summary>
public class Server : IServer
{
private readonly Engine.Engine engine;
private readonly RequestDelegate _requestDelegate;
/// <summary>
/// Initializes a new instance of the <see cref="Server"/> class.
/// </summary>
/// <param name="requestDelegate">The request delegate.</param>
/// <param name="logger">The logger.</param>
/// <param name="connection">The database connection.</param>
/// <param name="dataService">The data service.</param>
/// <param name="apiClient">The API client.</param>
public Server(RequestDelegate requestDelegate, ILogger logger, IDBConnection connection, IDataService dataService, IApiClient apiClient)
{
_requestDelegate = requestDelegate;
logger.Info("Legendary server is starting up...");
this.engine = new Engine.Engine(_requestDelegate, logger, connection, dataService, apiClient);
this.engine.Start();
}
/// <inheritdoc/>
public async Task Invoke(HttpContext context)
{
// TO-DO: Handle IP ban list
await this.engine.Invoke(context);
// Call the next delegate/middleware in the pipeline.
await _requestDelegate(context);
}
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.