Last post Mar 29, 2020 05:19 PM by emilector
Mar 28, 2020 04:01 PM|emilector|LINK
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:
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!!
Mar 28, 2020 07:17 PM|PatriceSc|LINK
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 ?
Mar 28, 2020 09:10 PM|emilector|LINK
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:
Maybe this guy describes it a little better than I can.
I have an Architecture like this:
But when accessing the Pages Folder to get to my Index.cshtml I get this:
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...
Mar 29, 2020 04:54 PM|PatriceSc|LINK
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.
Mar 29, 2020 05:19 PM|emilector|LINK
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!