且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Blazor服务器应用程序上的Server Error 403 Forbidden禁止发布到Linux托管

更新时间:2023-11-19 20:16:04

默认情况下, dotnet publish 发布用于在当前操作系统上运行的整个应用程序.如果与您打算运行应用程序的位置不匹配,则可以使用 -r | --runtime 指定要发布的运行时.

类似的东西应该起作用: dotnet publish -r linux-x64

I want to deploy a Hello World Blazor Server App created with the Blazor App Source Template 3.1.11 in VS2019 C#

The app is created in VS2019 on Windows 10

The docs show how to create the /bin/Release/{TARGET FRAMEWORK}/publish folder

I copied the files here to the domain folder in my hosting package, but do not know the next step.

web.config is for windows hosting. What do I need to do for Linux? At the moment I get a 403 error if I go to the site.

I can publish the app to a windows hosted site.

[Update] It turns out that the Linux server does not have DotNet installed.

By default, dotnet publish publishes the entire application for running on the current operating system. When that does not match where you intend to run the application you can specify the runtime to publish for with -r|--runtime.

Something like this should work: dotnet publish -r linux-x64