1

So I made a Net Core Web app project with razor pages and javascript files, as you can see on the right of the first screenshot, but I cannot seem to publish it as a web app, only console app or windows application.

For instance, when I publish it to folder, it does not even publish my razor pages, no index.cshtml at all.

Anyone ran into this issue before?

Project properties screenshot

Published folder

Inside wwwroot folder

Aiyuni
  • 780
  • 5
  • 15
  • in .net core they get all compiled in. – Daniel A. White Aug 06 '19 at 00:44
  • what do you mean by that – Aiyuni Aug 06 '19 at 16:00
  • meaning you won't see the razor pages as loose files. they are part of the dll – Daniel A. White Aug 06 '19 at 17:35
  • okay, but then how do I deploy it? From what I know, when you deploy any website, it has to look for a index.html page, which is the default page that is opened up when you launch the site. Which published file is the index page for razor pages? – Aiyuni Aug 06 '19 at 17:37
  • https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/?view=aspnetcore-2.2 – Daniel A. White Aug 06 '19 at 17:40
  • It says on there that 'An ASP.NET Core app is a console app that must be started when a server boots and restarted if it crashes.' am I reading something entirely wrong? My ASP.NET Core app is a web app (its a chat website that works perfectly fine on my localhost) – Aiyuni Aug 06 '19 at 17:54
  • I'm trying to deploy a web app made using net core, so I find it really weird that it says a net core is a console app... – Aiyuni Aug 06 '19 at 17:55

1 Answers1

0

Razor pages .cshtml files will be embedded into the web.config file after publishing.

It seems like you are using a regular Linux FTP. Make sure you are using a windows server to publish your app on. Net Core does not work on Linux servers unless you install the Net Core runtime on the server.

  • .Net Core does not work on [Linux](https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/linux-nginx?view=aspnetcore-2.2)? Explain. – Jeroen Heier Aug 20 '19 at 17:44
  • It does not work out of the box since Net Core is windows afaik. To make it work you will need to install the Net Core runtime on the Linux server. –  Aug 20 '19 at 17:48
  • See this [SO Question](https://stackoverflow.com/questions/26908049/what-is-net-core) and the answers given. – Jeroen Heier Aug 21 '19 at 18:51