gpt4 book ai didi

Azure 看不到 Index.cshtml

转载 作者:行者123 更新时间:2023-12-03 05:48:39 31 4
gpt4 key购买 nike

我正在尝试在 Azure 服务上发布我的 ASP.NET Core 应用程序。这有效,但是当我尝试使用应用程序功能时,我收到消息

Your App Service app is up and running.

此外,在我的 wwwroot 文件夹中,我没有任何 .html 文件。我只有一个 Index.cshtml 文件,位于我的应用程序的 Views/Home 文件夹中,所有其他文件都是 .css.js

当我在 Visual Studio 中以 Debug模式运行应用程序时,立即在浏览器中打开从 Index.cshtml 生成的页面。但应用程序在Azure中发布后,这种情况就不会发生。

如何才能让 Azure 看到 Index.cshtml

最佳答案

据我所知,默认路由将添加到 Startup.cs 文件的 Configure 方法中,如下所示:

app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});

我还创建了我的 .Net Core 2.0 MVC 应用程序来检查此问题,它可以在本地端和我的 azure Web 应用程序上按预期工作。

Moreover, in my wwwroot folder I don't have any .html files.

Web 应用程序和 Web 应用程序 MVC 下的 View 将编译为 {your-webapplication- assemblyname}.PrecompiledViews.dll,您可以利用 ILSpy检查您的 DLL。

对于您的问题,我建议您通过 KUDU 清除网络应用中的网络内容,或修改发布设置并选择“文件发布选项”下的删除目标位置的其他文件,然后将应用程序重新部署到 Azure Web App 以缩小此问题的范围。

关于Azure 看不到 Index.cshtml,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50553478/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com