Azure website message "You do not have permission to view this directory or page.". What to do?

132,336

Solution 1

You do not have permission to view this directory or page.

That basically a hint that Azure encounter an error while running your web app. Since its in production, it does not show any useful error messages. For testing/debugging purposes you can turn on the Azure detailed messaging, and turn back off when its ready for production. To do so, you have to follow these two steps,

  • Login to Azure > App Services (left side menu) > Your Web App > App Service logs (search box is at the top if you can't find it), then turn on Detailed Error Messages or turn on all of the logging options, up to you.
  • Now add the following in your Web Config file,
  • In your Web Config file add <customErrors mode="Off" /> BEFORE system.web closing tag, </system.web>. Similarly, add <httpErrors errorMode="Detailed"></httpErrors> BEFORE </system.webServer>. Finally, upload the Web Config to Azure and cross your fingers.

If you follow the steps correctly, that will show the error messages in detail and hopefully from there you will figure out what went wrong. Good Luck!

Solution 2

  • The fist thing you should do is actually go and check the folders if your war got unpacked inside the webapps folder. for that if your web url is "xyz.azurewebsites.net" then try to open xyz.scm.azurewebsites.net. This should redirect you to KUDU interface where you can see few tabs. From those tabs select Debug Console and then select CMD from the drop down. This should give you a folder structure.Now Go to site->wwwroot->webapps . There check if your war got unpacked.
  • If not then try restarting the web app and see id this does the trick. If while creating your app service plan you have selected the Standard pricing tier, change it to premium
  • Last but not the list you can enable logging for you app. Then go to Monitoring-> Diagnostics logs . Turn those setting on. Then select Log streaming(Just below Diagnostics logs).

Hope this help.

Solution 3

From my experience, if your login user ID under Azure Active Directory (AAD), you have to modify in Settings:

  • Authentication / Authorization
  • App Service Authentication, "ON" =>> choose: Log in With Azure Active Directory
  • Select 'ActivityProvider', base on your purpose. In my case, I'm using AAD.
  • Configured (Express: Existing APP)
  • Manage Azure Active Directory: Manage Permission & Manage Application

For Manage Permission ==>> Add, In Delegate Permission, choose: Sign in and read user profile and refresh your browser to login again

Solution 4

You do not have permission to view this directory or page.

This message show when you have restrict ip on IIS config. Check your Web.config file and add your ip address in security section like below:

<security>
<ipSecurity allowUnlisted="false">
<clear />
<add ipAddress="192.168.250.70" allowed="true" />
</ipSecurity >
</security>

Remove it if you do not want to restrict any ip address.

Solution 5

From the error description, it is not very clear about what went wrong here.

You may check whether the deployed files are available or not using Kudu Console.

Also, make sure that your startup file (For ex: index.htm) is added to the default documents section.

I would suggest you refer Enable diagnostics logging for web apps in Azure App Service and Troubleshoot ASP.NET Core on Azure App Service to check the complete error details and root cause.

Share:
132,336
Adam
Author by

Adam

Hi, my name's Adam. I am trying to build apps in Xamarin.Forms.

Updated on January 26, 2022

Comments

  • Adam
    Adam over 2 years

    After I published an ASP.NET Core app to Azure from Visual Studio 2017 I am getting this message when I click on the app url:

    enter image description here

    It was working fine before. Is there some way to reset the source code or the app?

    Do you have any solutions?

  • Adam
    Adam over 6 years
    The problem is that some source code files (of the app website) are missing. Is there some way to restore them. If not I will delete and recreate the app (the app is not public yet).
  • Hafiz Temuri
    Hafiz Temuri over 6 years
    source code files are missing Can you elaborate on that, please? How they are missing? Did someone delete them? If you know what files are missing, you can re-upload them. Or if you still have a source code, you can try re-deploying the whole application. If the files are deleted from Azure, they are gone forever (I believe), unless you have configured backup on Azure.
  • Hafiz Temuri
    Hafiz Temuri over 6 years
    Also, you can check all your web app files though KUDU Console. Follow this link, <your_web_app_name>.azurewebsites.net > Debug Console (from top menu) > CMD/PowerShell > Site > wwwroot. That should contains all your files.
  • Adam
    Adam over 6 years
    OK, I resolved it. I re-uploaded them. Now it is working. Thank you !
  • Jamesits
    Jamesits about 5 years
    in my case, the auto-created application permission is having the problem. Manually remove the delegation (and everything that has a white exclamation mark) and then re-adding the permission worked for me.
  • Sage
    Sage over 4 years
    Attempting this fix immediately resolved the issue for us. We deployed a dotnet Core application to Azure App Services, which was failing with the above error. In all of our Terraform, we default always_on=true and have never had this issue before. For some reason, with our new Application, this became a problem. Do you know of any reason WHY "Always On" would cause this issue?
  • Ryan D
    Ryan D about 4 years
    I had a goof in my build process that failed to include the index.html so this error message can indeed be caused my missing the default page. A little misleading since I would have expected a 404 but I suppose it's actually saying that you do not have permission to directory browse at the root.
  • Gordon Westerman
    Gordon Westerman about 4 years
    Thank you very much! In my case I was deploying an Angular application and my data was deployed to 'wwwroot/appname/' instead of 'wwwroot/'. I had already tried to check this via FTP but for some reason I was (and currently still am) not shown the actual data used by the webserver, which your solution does.
  • PotatoFarmer
    PotatoFarmer about 4 years
    +1 on missing files/404 - my case accidentally selected "prepend root folder name to archive paths" and it resulted in the hosted wwwroot having a folder called "dist" rather than the expected index.html etc. While the error was a 403, my actual case was a 404.
  • melkorCba
    melkorCba over 3 years
    I had the same issue. What I did was add that dir to the app service dir, like "dist/my-directory"
  • Jimmy
    Jimmy over 3 years
    @spottedmahn Does the web.config settings works for windows-based app other than dotnet or asp.net runtime? For example, nodejs or python?
  • Pratap Singh Mehra
    Pratap Singh Mehra about 3 years
    For me it was web.config. Fixed the configuration and it started working.
  • Klom Dark
    Klom Dark almost 3 years
    index.php? this is not php.
  • Jasir
    Jasir over 2 years
    @HafizTemuri Shouldn't it be <your_web_app_name>.scm.azurewebsites.net ?
  • Hafiz Temuri
    Hafiz Temuri over 2 years
    @JasirKT I think scm takes you to the terminal? I could be wrong, it was 4 years ago. Things may have changed recently.
  • Jasir
    Jasir about 2 years
    Yes @HafizTemuri, it still takes to the terminal. In your comment above, didn't you mean to do it in terminal?
  • Hafiz Temuri
    Hafiz Temuri about 2 years
    Yes, you can go directly to through scm. But in my above comment, I mentioned going through Debug Console. Both ways will get you to the terminal. Either through Debug Console (UI) or directly through .scm.