本文介绍了Blazor WebAssembly 发布失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试发布面向 .NET 5.0 的 Blazor WebAssembly 应用程序.我使用默认设置从 Visual Studio 2019 创建了一个新的 Web 部署发布配置文件:

I'm trying to publish a Blazor WebAssembly App, targeting .NET 5.0.I created a new Web Deploy publish profile from Visual Studio 2019, using the default settings:

该站点已发布到 IIS,但浏览器显示 500.19 - 内部服务器错误:无法访问请求的页面,因为该页面的相关配置数据无效."

The site is published to IIS, but the browser is displaying a 500.19 - Internal Server Error: "The requested page cannot be accessed because the related configuration data for the page is invalid."

web.config 有一个奇怪的路径,它以\\?\"开头:

There's a strange path for web.config, which is starting with "\\?\":

\\?\C:\inetpub\wwwroot\__ClientBlazor\web.config

我已经尝试了在类似线程上找到的任何建议,但没有一个能解决问题.会不会是 Blazor 项目中 VS 发布向导的特定错误?

I've tried any of the suggestions I've found on similar threads, but none of them solve the problem.Could it be a specific bug of VS publish wizard on Blazor projects?

推荐答案

原来是 url-rewrite 问题,这个 IIS 解决了这个问题 Url Rewrite 扩展.只需安装扩展程序并重新发布应用程序即可.

Turns out that it was an url-rewrite problem, which is addressed by this IIS Url Rewrite extension.Simply install the extension and the republish the app, it will work.

然后会引发其他错误,如下所示:每个 css 和 javascript 资源上的 404(参见 this 了解更多详情和一个非常奇怪的解决方案.

BUT other errors will then be raised, like the following:404 on every css and javascript resources (see this and that for further details and a really weird solution).

这篇关于Blazor WebAssembly 发布失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-05 20:07