Reputation: 707
I have googled for the past 3 hours and found nothing on what to do with respect to the windows azure problem:
You do not have permission to view this directory or page.
I did a git master push to azure and the deployment was successful. I also turned on the failed request tracing but nothing shows up but the above statement.
Any ideas on how to troubleshoot this?
Upvotes: 32
Views: 34083
Reputation: 1161
Lots of answers, but I didn't see one that addressed the "how do I debug this?" question, which wasn't obvious to me as someone who is new to Azure and hadn't yet used Kudu diagnostics.
To see the debugging info you're looking for, just navigate to
mywebsite.scm.azurewebsites.net
when you encounter the "You do not have permission to view this directory or page." error on your own
mywebsite.azurewebsites.net
page. This will get you to the Kudu console and give you easy access to everything currently in your logs.
See also the many answers to the closed-but-popular How to debug "You do not have permission to view this directory or page"? question.
Upvotes: 0
Reputation: 7353
AvkashChauhan's answer did lead me in the right direction but I also had to add proper rewriting rules. Here is my complete web.config
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation batch="false" />
</system.web>
<system.webServer>
<handlers>
<add name="iisnode" path="server.js" verb="*" modules="iisnode" />
</handlers>
<rewrite>
<rules>
<rule name="myapp">
<match url="/*" />
<action type="Rewrite" url="server.js" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
Upvotes: 11
Reputation: 29427
I had the same error message after a git push
from a local repository.
Solved it by opening the Azure dashboard:
Web app / App deployment / deployment source
and selecting local git repository as deployment source
Upvotes: 0
Reputation: 4215
The azure tools have changed a lot since this question.
I recommend people using the azure-cli. But funny enough I actually don't use it after I have used it once to create a site.
What I use now is just the ability to push (git) directly to a remote that is named azure, and the cli is setting that up for you.
But if you don't want to install the cli you can essentially just add the remote repo (your site) manually, like this:
git remote add azure https://<site-or-appservice-name>.scm.azurewebsites.net/<site-or-appservice-name>.git
As you would with every other git remote.
Upvotes: 3
Reputation: 1
Simple configuration, in the azure portal go to your web app -> All settings -> application settings, under default documents add the specific name of your document which you want to view, wait for it to update, then refresh your azure link.
Upvotes: 0
Reputation: 4629
I just came across this issue and in my case it was the ipSecurity configuration that was causing the issue. Just hd to go and change the allowUnlisted to true.
<security>
<ipSecurity allowUnlisted="false">
</security>
Upvotes: 0
Reputation: 22575
I hit this error too. I am using MVC and the reason for the error was that on my layout page I had a call to an action that isn't accessible to anonymous users:
@Html.Action("GetMenu", "Users")
For information, I register a AuthorizeAttribute()
global filter in Application_Start and my Login
action is decorated with AllowAnonymous
:
[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public ActionResult Login(LoginModel model, string returnUrl)
{
My website did work previously on IIS7, but Azure is less forgiving. I fixed the problem by adding a check like this:
@if (User.Identity.IsAuthenticated)
{
@Html.Action("GetMenu", "Users")
}
Upvotes: 3
Reputation: 2924
Not specific to node.js but updating in case it helps others facing this issue for a regular web application. This can also happen if the index.html file is not present or is not found because it is in a sub-directory
Upvotes: 2
Reputation: 20576
I just tested that if you don't deploy your main node.js file as server.js you will get this error because the web.config is specifically looking for server.js as below:
<handlers>
<add name="iisnode" path="server.js" verb="*" modules="iisnode"/>
</handlers>
To further troubleshot this issue you can access the website over FTP as described here.
Upvotes: 19