A default document is not configured for the requested URL, and directory browsing is not enabled on the server

前端 未结 12 842
时光说笑
时光说笑 2020-12-13 03:37

I have just deployed my asp.net mvc-2 website to a server (using dotnetpanel). But getting this error

A default document is not configured for the requested          


        
相关标签:
12条回答
  • 2020-12-13 04:19

    I know its too late to post answer, but i found completely differently scenario. I tried all possible solution given above but that not works for me. I found very silly mistake / ignorance in my case I checked IIS manager window carefully and found asp.net section was missing there. I have made Turn Windows features on for ASP.net, below is the steps

    1. Open Control Panel
    2. Programs\Turn Windows Features on or off Internet
    3. Information Services World Wide Web Services Application development
    4. Check for - >Features ASP.Net

    I have closed IIS manager window and reopened it, now ASP.NET section is visible. just browse hosted website and it's up on browser.

    0 讨论(0)
  • 2020-12-13 04:20

    This can also occur if you do something stupid (like I did) and place the api url in the "Project Url" (e.g. http://localhost:59088/api/Product) on the Project Properties->Web tab instead of specifying it in the "Specific Page" text box. This causes Visual Studio to go ahead and create an APP called ProjectName/api/Product, and this will expect a default page. The only way to undo this is to go to C:\Program Files (x86)\IIS Express and use appcmd.exe to delete it like so

    >.\appcmd.exe delete APP "ProjectName/api/Product"
    
    0 讨论(0)
  • 2020-12-13 04:20

    Make sure you have your default page named as index.aspx and not something like main.aspx or home.aspx . And also see to it that all your properties in your class matches exactly with that of your table in the database. Remove any properties that is not in sync with the database. That solved my problem!! :)

    0 讨论(0)
  • 2020-12-13 04:23

    I faced the same error posted by OP while trying to debug my ASP.NET website using IIS Express server. IIS Express is used by Visual Studio to run the website when we press F5.

    Open solution explorer in Visual Studio -> Expand the web application project node (StudentInfo in my case) -> Right click on the web page which you want to get loaded when your website starts(StudentPortal.aspx in my case) -> Select Set as Start Page option from the context menu as shown below. It started to work from the next run.

    Root cause: I concluded that the start page which is the default document for the website wasn't set correctly or had got messed up somehow during development.

    0 讨论(0)
  • 2020-12-13 04:30

    Following applies to IIS 7

    The error is trying to tell you that one of two things is not working properly:

    • There is no default page (e.g., index.html, default.aspx) for your site. This could mean that the Default Document "feature" is entirely disabled, or just misconfigured.
    • Directory browsing isn't enabled. That is, if you're not serving a default page for your site, maybe you intend to let users navigate the directory contents of your site via http (like a remote "windows explorer").

    See the following link for instructions on how to diagnose and fix the above issues.

    http://support.microsoft.com/kb/942062/en-us

    If neither of these issues is the problem, another thing to check is to make sure that the application pool configured for your website (under IIS Manager, select your website, and click "Basic Settings" on the far right) is configured with the same .Net framework version (in IIS Manager, under "Application Pools") as the targetFramework configured in your web.config, e.g.:

    <configuration>
      <system.web>
        <compilation debug="true" targetFramework="4.0" />
        <httpRuntime targetFramework="4.0" />
      </system.web>
    

    I'm not sure why this would generate such a seemingly unrelated error message, but it did for me.

    0 讨论(0)
  • 2020-12-13 04:31

    The answer marked will help you eliminate the error but it will not get MVC working. The answer to the problem is to add this line to the web.config file in system.webServer:

    <modules runAllManagedModulesForAllRequests="true" />
    
    0 讨论(0)
提交回复
热议问题