最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Azure WebApp (Windows) - You do not have permission to view this directory or page - Stack Overflow

programmeradmin1浏览0评论

I have simple NodeJS app created by npx express-generator myExpressApp --view ejs following this instruction - ;pivots=development-environment-vscode#create-your-nodejs-application

I use GitHub actions task azure/webapps-deploy@v3 and it's deployed to Linux-based WebApp as a charm
However if I deploy to Windows-based WebApp I'm getting You do not have permission to view this directory or page. on the WebApp's page
Deploy logs in Windows-based WebApp are all good
I tried zip and msdeploy for type in azure/webapps-deploy@v3, result is the same
How it could be fixed?

I have simple NodeJS app created by npx express-generator myExpressApp --view ejs following this instruction - https://learn.microsoft/en-us/azure/app-service/quickstart-nodejs?tabs=linux&pivots=development-environment-vscode#create-your-nodejs-application

I use GitHub actions task azure/webapps-deploy@v3 and it's deployed to Linux-based WebApp as a charm
However if I deploy to Windows-based WebApp I'm getting You do not have permission to view this directory or page. on the WebApp's page
Deploy logs in Windows-based WebApp are all good
I tried zip and msdeploy for type in azure/webapps-deploy@v3, result is the same
How it could be fixed?

Share Improve this question edited Mar 20 at 10:44 Harshitha 7,4852 gold badges6 silver badges17 bronze badges Recognized by Microsoft Azure Collective asked Mar 18 at 17:23 kagarlickijkagarlickij 8,15912 gold badges44 silver badges81 bronze badges 2
  • Did you try all the steps mentioned for Windows – Harshitha Commented Mar 19 at 9:31
  • I am able to resolve the issue by manually adding the web.config file in the application root directory. – Harshitha Commented Mar 19 at 10:11
Add a comment  | 

1 Answer 1

Reset to default 1

Even I am getting same error when I deployed the app using GitHub actions.

In this MSDoc it is clearly mentioned the requirement of web.config file while running the app in Windows.

  • Deploying the app using GitHub actions will not add the config file. Manually add the web.config file from KUDU in the site/wwwroot directory.

    Sample web.config file:

    
    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <system.webServer>
        <webSocket enabled="false" />
        <handlers>
          <add name="iisnode" path="bin/www" verb="*" modules="iisnode"/>
        </handlers>
        <rewrite>
          <rules>
            <rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true">
              <match url="^bin/www\/debug[\/]?" />
            </rule>
            <rule name="StaticContent">
              <action type="Rewrite" url="public{PATH_INFO}"/>
            </rule>       
            <rule name="DynamicContent">
              <conditions>
                <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True"/>
              </conditions>
              <action type="Rewrite" url="bin/www"/>
            </rule>
          </rules>
        </rewrite>  
        <security>
          <requestFiltering>
            <hiddenSegments>
              <remove segment="bin"/>
            </hiddenSegments>
          </requestFiltering>
        </security>
    
        <httpErrors existingResponse="PassThrough" />
    
      </system.webServer>
    </configuration>
    
    

If you are deploying from VSCode, then add SCM_DO_BUILD_DURING_DEPLOYMENT Application setting with value true.

  • Add the setting from VSCode or directly from the portal.

VSCode:

Portal:

  • Redeploy the app once again from VSCode.

Output:

  • Also make sure your Physical Path is mapped to site\wwwroot under Path Mappings.
发布评论

评论列表(0)

  1. 暂无评论