如何将blazor客户端/服务器应用发布到linux Web服务器?没有访问ssh的权限,并且dotnet publish没有给出index.html [英] How can I publish a blazor client/server app to a linux web server? Don't have access to ssh and dotnet publish doesn't give an index.html

查看:57
本文介绍了如何将blazor客户端/服务器应用发布到linux Web服务器?没有访问ssh的权限,并且dotnet publish没有给出index.html的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经构建了目前没有任何问题的blazor应用程序.当我称"dotnet publish -c Release"时,我得到一个已发布的项目,除了输出是一个可执行文件,ubuntu将其作为八位字节流或类似的东西拾取.如果我运行它,它将在localhost:5000上打开服务器.通过cpanel将其复制到我的Web服务器上没有任何作用-甚至尝试测试通用的Blazor Wasm应用程序并发布它都给了我index.html,但是当我将其上传到我的Web服务器时,它实际上不会加载任何内容.我如何获得dotnet来使用index.html文件发布它?我所得到的只是js和css文件夹以及外部"wwwroot"目录中的可执行文件.文件夹.

(P.S.我将webhostingpad.com与共享主机一起使用,因此我无权使用ssh来执行诸如安装nginx或通过IIS或Azure的并行路由之类的操作)

解决方案

Blazor WebAssembly:

Blazor服务器:

https://docs.microsoft.com/zh-cn/aspnet/core/blazor/host-and-deploy/server?view=aspnetcore-3.1#linux-with-apache

I've built a blazor app that has no issues at the moment. When I call "dotnet publish -c Release" I get a published project, except the output is an executable file that ubuntu picks up as an octet-stream or something along the lines. If I run it, it just opens the server on localhost:5000. Copying this to my web server through cpanel did nothing -- even trying to test out a generic blazor Wasm app and publishing it gave me an index.html, but it would never actually load anything when I uploaded it to my web server. How can I get dotnet to publish this with an index.html file? All I get is the js and css folders and the executable file on the outer "wwwroot" folder.

(P.S. I'm using webhostingpad.com with shared hosting, so I don't have access to ssh to do things like installing nginx or a parallel route through IIS or Azure or something)

解决方案

Blazor WebAssembly:

https://docs.microsoft.com/en-us/aspnet/core/blazor/host-and-deploy/webassembly?view=aspnetcore-3.1#standalone-deployment

  • scroll down to "Apache"

Blazor server:

https://docs.microsoft.com/en-us/aspnet/core/blazor/host-and-deploy/server?view=aspnetcore-3.1#linux-with-apache

这篇关于如何将blazor客户端/服务器应用发布到linux Web服务器?没有访问ssh的权限,并且dotnet publish没有给出index.html的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆