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

前端 未结 10 1866
陌清茗
陌清茗 2020-11-28 11:54

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:

It was working fine before. Is

相关标签:
10条回答
  • 2020-11-28 12:31
    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.

    0 讨论(0)
  • 2020-11-28 12:31

    Just to add to the solutions: in my case I updated the application but the application pool was set to "Always On" so something had "confused it". All I had to do was:

    • go to the site settings in the Azure portal
    • then select configuration under Settings
    • then select the General Settings tab on the configuration page
    • On the General settings tab switch "Always On" to Off
    • and reconnect to your site as normal.
    • When the site is back up and running switch "Always On" back to On.
    0 讨论(0)
  • 2020-11-28 12:31

    Another useful workaround is on the page Jimmy pointed out go to "Defaul documents" tab and add the name of your main file (it should be index.html) but if not add it.

    That solved my problem.

    0 讨论(0)
  • 2020-11-28 12:33

    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!

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