0

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

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.

files

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.

Kirsten
  • 15,730
  • 41
  • 179
  • 318
  • https://stackoverflow.com/questions/63678029/how-can-i-publish-a-blazor-client-server-app-to-a-linux-web-server-dont-have-a?rq=1 – Kirsten Jan 04 '21 at 02:42
  • Forbidden means forbidden. Please increase the error output or check out why you get the forbidden error. Have you bad file/folder permissions or bad user/group/world ownership? Are you using Kestrel? Have you tried net5.0 (You need to change existing template. See tutorials)? What about SSL? So many questions.. Have you tried that link above? Normally not needed when developing (Apache). – Teneko Jan 12 '21 at 02:28
  • @Teroneko Where do I do that ? Do I need to create some kind of configuration file ? Publish does not seem to create one. – Kirsten Jan 12 '21 at 02:43

2 Answers2

2

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

Tim
  • 2,587
  • 13
  • 18
  • Thank you. However I still get the 403 – Kirsten Jan 11 '21 at 23:30
  • 1
    Is .NET installed on the server? You might want to try updating your publish statement to `dotnet publish -r linux-x64 --self-contained` so that the runtime is included with the deployment – Tim Jan 12 '21 at 17:47
  • Alas I still have the 403 – Kirsten Jan 13 '21 at 16:12
  • 1
    It sounds like your webhost is trying to serve static content rather than run the .NET application. The entrypoint is `./BlazorApp1` if you can configure that somewhere. – Tim Jan 13 '21 at 17:59
  • Doing a test deploy to azure instead. The Azure Deploy wizard asks me to create an Azure SignalR Service. It publishes to Azure OK. Maybe I need to try a simpler Hello World for my chosen Linux hosting. – Kirsten Jan 13 '21 at 19:49
  • 1
    The SignalR Service piece is optional, just another way to scale part of the app https://stackoverflow.com/questions/60659477/why-is-azure-signalr-service-recommended-when-deploying-a-blazor-server-side-app – Tim Jan 13 '21 at 19:51
0

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

Matt
  • 23
  • 3