0

Actually I created a webapp and successfully deployed my code into the web app but when I try to access the webapp through URL it showing like this : "You do not have permission to view this directory or page." I don't know why it is happening. I tried to create different webapps but still the same thing is repeating. Can anyone help me out to solve this? For your reference I am adding a picture of the error message.enter image description here

I want someone to resolve this as soon as possible. Actually I am in a project need to sort it out quickly to go ahead.

  • your message say you are not authorized to see the web page. you can check is the authentication applied to your app service, in portal search for authentication under stetting. – Gautam Sharma Jun 06 '23 at 09:49
  • Refer this SO thread 1 https://stackoverflow.com/questions/44012135/azure-asp-net-core-web-app-says-you-do-not-have-permission-to-view-this-directo and this SO thread 2 https://stackoverflow.com/questions/48853599/how-to-debug-you-do-not-have-permission-to-view-this-directory-or-page) for the similar issue as yours. – SiddheshDesai Jun 06 '23 at 12:16

1 Answers1

0

I tried to deploy Azure Web app with YAML and Release pipeline and it was successful:-

I have referred MS Document1 and MS Document2 for the pipeline code below:-

My Build Pipeline:-

trigger:
- master

pool:
  vmImage: windows-latest

steps:

- task: UseDotNet@2
  inputs:
    version: '6.x'

- task: UseDotNet@2
  displayName: 'Install .NET Core SDK'
  inputs:
    version: 6.x
    performMultiLevelLookup: true
    includePreviewVersions: true # Required for preview versions


- task: DotNetCoreCLI@2
  displayName: Build
  inputs:
    command: build
    projects: '**/*.csproj'
    arguments: '--configuration $(buildConfiguration)' # Update this to match your need


- task: DotNetCoreCLI@2
  inputs:
    command: publish
    publishWebProjects: True
    arguments: '--configuration $(BuildConfiguration) --output $(Build.ArtifactStagingDirectory)'
    zipAfterPublish: True

- task: PublishPipelineArtifact@1
  inputs:
    targetPath: '$(Build.ArtifactStagingDirectory)' 
    artifactName: 'myWebsiteName'

- task: AzureWebApp@1
  inputs:
    azureSubscription: '<subscription>'
    appType: 'webApp'
    appName: 'siliconwebapp32'
    package: '$(Build.ArtifactStagingDirectory)/**/*.zip'
    deploymentMethod: 'auto'

After the build was successful, The app was deployed. But I used the same build Artifact in my release pipeline to deploy it in another web app and it was successful, Refer below:-

My Release pipeline:-

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

In order to resolve your error:-

Make sure the Default document is present in your Web app, If not make sure to redeploy your app with proper path to the zipped source code:-

enter image description here

Validate and add the path mapping correctly like below:-

enter image description here

Check if there's any IP restrictions like here-

enter image description here

Check if the Files are correctly deployed by visiting > Advanced Tools > Go > Kudu > Debug console > CMD > site > Check whether all Files are present like below:-

enter image description here

Another way to upload your file and validate is via Zip push Deploy option in Kudu > Tools > Zip push Deploy, Refer below:-

enter image description here

enter image description here

If this does not work, enable App Service Logs like below:-

enter image description here

You can save the logs in your azure storage account and view them.

Check the Log stream and load your web app page for the logs to load and get insights:-

enter image description here

Additionally, Make sure you're using the correct zip file with codes and packages while deployment.

SiddheshDesai
  • 3,668
  • 1
  • 2
  • 11