HTTP Error 403.14 - Forbidden - MVC 4 with IIS Express

后端 未结 9 1668
栀梦
栀梦 2020-12-11 14:41

This seems like a question that has already been asked/answered many times. Its not.

Development Environment: VS 2012 and MVC 4. I am using the buil

相关标签:
9条回答
  • 2020-12-11 15:08

    Firstly, I'm assuming that

     http://localhost:49962/managescholars/
    

    is in fact

     http://localhost:49962/manage/scholars/
    

    . If not there's your problem :)

    I'm not an expert on routes, but in your route for Scholars the userFriendlyName param is not optional which means that http://localhost:49962/manage/scholars/ won't match any of your rules and IIS will treat it a request to list the content of the folder.

    0 讨论(0)
  • 2020-12-11 15:08

    In my case, with Visual Studio 2015, I solved the problem with the following steps:

    • Stop IIS Express
    • Close Visual studio
    • Delete file applicationhost.config in {my solution directory}.vs\config
    • Delete directory Documents\IISExpress\config
    • Start VS, F5 and enjoy :)
    0 讨论(0)
  • 2020-12-11 15:15

    Great !! In my case it was because I configured the application to run in a wrong url, but when I returned to the correct one, the look did not overwhelm the applicationhost.config.

    As I said above, I only managed to solve those steps.

    0 讨论(0)
  • 2020-12-11 15:18

    In case someone get the same problem I got and enter this page deseperatly. If debugging website works but not on one website :

    Check modification on global.asax Check if the route configuration is still present...

    I know it's dumb but lost 6 hours after a git merge...

    0 讨论(0)
  • 2020-12-11 15:18

    In my case, after using @Fl4v answer, I search for directoryBrowse attribute on file applicationhost.config in {my solution directory}.vs\config and there was false. Changed to true, restart iis and now it finnally works.

    0 讨论(0)
  • 2020-12-11 15:25

    I encountered the same problem. To solve is very easy.

    This problem occurs because of an IIS Express conflict when you edit the properties in the Protect URL in the Project settings. To solve this problem is very easy:

    1 - Look for the file "applicationhost.config" in the ".vs \ config" directory. This folder is at the root of the solution. You can open it using Notepad ++

    2 - Search for the name of your control using 'find' of your program (Ctrl + F). In my case, the control that gave problem was the 'Offices'.

    3 - Delete any node where you place the IIS settings for such a URL. See example below:

        <site name="G4.Admin(1)" id="8">
                    <application path="/" applicationPool="Clr4IntegratedAppPool">
                        <virtualDirectory path="/" physicalPath="C:\Projetos\PortalG4\src\G4.Admin" />
                        <virtualDirectory path="/Offices/Edit" physicalPath="C:\Projetos\PortalG4\src" />
                        <virtualDirectory path="/Offices" physicalPath="C:\Projetos\PortalG4" />
                    </application>
                    <application path="/Offices/Edit/2" applicationPool="Clr4IntegratedAppPool">
                        <virtualDirectory path="/" physicalPath="C:\Projetos\PortalG4\src\G4.Admin" />
                    </application>
                    <bindings>
                        <binding protocol="http" bindingInformation="*:6920:localhost" />
                    </bindings>
                </site>

    You should delete every element

    <site name = "NAME_PROJECT" id = "X">
    

    Note: Make a backup of the file before making the changes.

    Hugs

    0 讨论(0)
提交回复
热议问题