-5

I have published this project in Visual Studio 2019 and set it in IIS.

When I run the page as localhost on port 80, I'm getting HTTP 403.14 error. enter image description here

I have done all the steps in this tutorial for deployment. Did I omit something important?

When I drop test.html in the C:\inetpub\deploy directory test.html is loaded successfully.

xralf
  • 3,312
  • 45
  • 129
  • 200
  • 1
    Your question doesn't make any sense. [tag:asp.net-mvc] does not serve *pages* as cshtml to the client. It sounds like you want to expose your code to the world, really not a good idea. – Erik Philips Sep 06 '19 at 18:34
  • @ErikPhilips I corrected the title of the question. – xralf Sep 06 '19 at 18:40
  • 1
    You don't need to set a root document - the app should glob onto the requests that end in / and look for a default action - depending on how your routes are set up. It wouldn't make sense to have _ViewStart.cshtml as a root anyways - that's a view partial and should never be directly rendered to the client. – mason Sep 06 '19 at 18:44
  • If you're getting a 403 - then you need to check to make sure ASP.NET is enabled on the server, that the app pool has correct version of .NET, and that your app has been compiled and deployed properly to the site root. – mason Sep 06 '19 at 18:46
  • @mason I have done all the steps in [this](https://www.c-sharpcorner.com/article/asp-net-mvc5-deployment-on-windows-iis-server/) tutorial for deployment. – xralf Sep 06 '19 at 18:54
  • Did you follow all the steps in the prerequisites listed in the tutorial? Are you able to access pages within your website by typing a full path to individual actions? – mason Sep 06 '19 at 18:57
  • @mason Yes, Initially was missing Web Deploy and I installed v3.6. I could access the default website, but I deleted it, because when I typed localhost it was always there the default site. – xralf Sep 06 '19 at 19:01
  • Are you sure you're hitting the right site, according to your bindings? What happens if you drop a test.html file with some content into the root of your site, then attempt to navigate to it in your browser? Do you see it? – mason Sep 06 '19 at 19:25
  • @mason I can look on monday. – xralf Sep 06 '19 at 23:38
  • Could you please post the details error message for the 403 error? I suggest you could also check your application pool identity to make sure you have set the enough permission to access the folder for the MVC file. – Brando Zhang Sep 09 '19 at 08:14
  • @mason Yes, I can see test.html when I drop it in the root. – xralf Sep 09 '19 at 12:21
  • @BrandoZhang test.html as mason suggested works. What do you mean by check your application pool identity ... – xralf Sep 09 '19 at 12:34
  • You're confusing a couple of terms, making your question illogical. You should not fiddle with serving *.cshtml files, they are not for end users. You should not mess with the document root, that's just the starting directory for your web application. You definitely shouldn't try to serve *.cshtml files as default documents; this will mess up your site and expose the code written in your views. And you should never, ever reference or access `_Viewstart.cshtml` directly; it's a file that's included by convention. There's a _lot_ wrong with your question, a lot of info is missing. – CodeCaster Sep 09 '19 at 12:47
  • @CodeCaster I clarified the question. – xralf Sep 09 '19 at 13:06

2 Answers2

1

Initially was missing Web Deploy and I installed v3.6

This is required for Visual Studio tooling, i.e., the deployment procedure, but not real IIS functionally.

I can see test.html when I drop it in the root.

This also does not guarantee that the MVC prerequisites are properly installed. Handling static files is minimum setup configuration of any web server.

I have done all the steps in this tutorial for deployment.

This may be exceeded. Try to create a simple ASP.NET MVC application first to check the routing + modules:

(File -> New -> Project -> Web -> ASP.NET Web Application (.NET Framework) -> Empty -> Mvc, Add -> Controller + View)

Build, run and test the created app locally. If everything is ok under the IIS Express, deploy this app to the problematic IIS (in the same manner, as a new root application, as a child application).

Did I omit something important?

If you see the same error, make sure that you have implemented all the prerequisites until you see the real app details (if any). Check the following threads:

ASP.NET MVC on IIS 7.5

ASP MVC in IIS 7 results in: HTTP Error 403.14 - Forbidden

Mikhail
  • 9,186
  • 4
  • 33
  • 49
  • 1
    My colleage told me that he changed the root, the physical path and it worked. Thank you for complete answer. – xralf Sep 17 '19 at 13:59
-1

Your question description is bit broad. There can be many things involved in this like authentication, .NET Feature enabling. Check below section in web.config, if not present add these line and try.

<system.webServer>
<directoryBrowse enabled="true" />

user1597990
  • 181
  • 3
  • 13