Server Error 403 Forbidden on Blazor server app published to Linux hosting

亡梦爱人 提交于 2021-01-29 15:28:16

问题


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.


回答1:


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




回答2:


A 403 error would lie somewhere in the IIS/web server configuration. Look at the config file or the IIS settings.



来源:https://stackoverflow.com/questions/65557009/server-error-403-forbidden-on-blazor-server-app-published-to-linux-hosting

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!