Getting error after pushing to Windows Azure: You do not have permission to view this directory or page
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.
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>
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")}