locked
asp.net Core & Plesk Combination RRS feed

  • Question

  • User-2104573357 posted

    Hi,

    for some hours now I have been struggling with this:

    I have created an asp.net Core Application in C# with Visual Studio. Also I have rented a Virtual Windows 2016 Server with Plesk preinstalled. My goal is simply to get my Web Application running on this Server. What I have tried so far:

    • Uploaded my entire Solution Folder / my Bin Folder / a published Version into my Plesk File Manager - unfortunately when I try to set the index.cshtml File as root Page, Plesk forbids me to use .cshtml files...
    • Added a index.html file to my asp.net project and made it my startup page, but now: how do I redirect to the index.cshtml file, because something like

    https://localhost:44379/../Pages/index.cshtml didn't work...

    Is this even supposed to work like this, just by adding my Project files to Plesk?

    Thank you for any help on this!!

    emilector

    Saturday, March 28, 2020 4:01 PM

Answers

  • User753101303 posted

    Hi,

    This is similar to MVC ie you don't access directly to the file but through a simpler url such as https://site.com/index and IIS/ASP.NET Core does the job of mapping this url to serve back the the correct file from the Pages folder. Also index.cstml is the default file so https://site.com should work as well.

    See  https://www.learnrazorpages.com/razor-pages/routing for details. What if you start with this simpler url?

    Edit: also it is unclear. I would suggest to publish to a folder and then upload only those files. You have full copntrol on this server ? Does it support ASP.NET Core ?

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, March 28, 2020 7:17 PM
  • User753101303 posted

    The first thing I'm trying to tell is that this behavior is expected. You NEVER access directly to filles found in the Pages folder.

    The incoming url is processed and https://localhost:44397/mypage  will render the content of the ~/Pages/mypage.cshtml file (most often compiled to a DLL).  In addition index.cshtml is the defauit page name and so using https://localhost:44397 or https://localhost:44397/index, will render the Pages/index.cshtml file.

    Also you published your app to a folder before trying to dpeloy it ? It seems also you have a mix between ASP.NET 4.x and ASP.NET Core (for which the web.config is usally much smaller).

    I would suggest to use https://docs.microsoft.com/en-US/visualstudio/deployment/quickstart-deploy-to-local-folder?view=vs-2019 if you can't publish directly to your server using webdeploy.

    If this is your first attempt (and a move from ASP.NET 4.x to ASP.NET Core ???), to see how it works juste do a tesdt with the default project and publish that to see how it works before doing back to your own project.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, March 29, 2020 4:54 PM

All replies

  • User753101303 posted

    Hi,

    This is similar to MVC ie you don't access directly to the file but through a simpler url such as https://site.com/index and IIS/ASP.NET Core does the job of mapping this url to serve back the the correct file from the Pages folder. Also index.cstml is the default file so https://site.com should work as well.

    See  https://www.learnrazorpages.com/razor-pages/routing for details. What if you start with this simpler url?

    Edit: also it is unclear. I would suggest to publish to a folder and then upload only those files. You have full copntrol on this server ? Does it support ASP.NET Core ?

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, March 28, 2020 7:17 PM
  • User-2104573357 posted

    Thank you for your answer. Yes I have Admin rights and it supports ASP.NET Core. It actually seems to be the same problem as here: 

    https://talk.plesk.com/threads/please-help-an-absolute-newbie-publish-a-net-core-application-to-plesk.353316/

    Maybe this guy describes it a little better than I can.

    I have an Architecture like this:

    https://ibb.co/yYqdvhj

    But when accessing the Pages Folder to get to my Index.cshtml I get this:

    https://ibb.co/vLhG7jZ

    It basically means these file types are forbidden...

    Now if as you said I don't access it directly, the Program doesn't know where to start / how to build the web page...

    Saturday, March 28, 2020 9:10 PM
  • User753101303 posted

    The first thing I'm trying to tell is that this behavior is expected. You NEVER access directly to filles found in the Pages folder.

    The incoming url is processed and https://localhost:44397/mypage  will render the content of the ~/Pages/mypage.cshtml file (most often compiled to a DLL).  In addition index.cshtml is the defauit page name and so using https://localhost:44397 or https://localhost:44397/index, will render the Pages/index.cshtml file.

    Also you published your app to a folder before trying to dpeloy it ? It seems also you have a mix between ASP.NET 4.x and ASP.NET Core (for which the web.config is usally much smaller).

    I would suggest to use https://docs.microsoft.com/en-US/visualstudio/deployment/quickstart-deploy-to-local-folder?view=vs-2019 if you can't publish directly to your server using webdeploy.

    If this is your first attempt (and a move from ASP.NET 4.x to ASP.NET Core ???), to see how it works juste do a tesdt with the default project and publish that to see how it works before doing back to your own project.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, March 29, 2020 4:54 PM
  • User-2104573357 posted

    So, I reinstalled my Server - this time without Plesk - and it works now! Don't know what was wrong before...

    Thank you for your help!

    emilector

    Sunday, March 29, 2020 5:19 PM