Azure错误。您无权查看此目录或页面

时间:2018-02-27 21:57:48

标签: asp.net azure

当我导航到我已部署的azure网站时,出现错误,

You do not have permission to view this directory or page.

在我的web.config

 <system.web>
    <compilation debug="true" targetFramework="4.7"/>
    <httpRuntime targetFramework="4.7"/>
  </system.web>
  <system.webServer>
    <handlers>
      <remove name="ExtensionlessUrlHandler-Integrated-4.0"/>
      <remove name="OPTIONSVerbHandler"/>
      <remove name="TRACEVerbHandler"/>
      <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler"
        preCondition="integratedMode,runtimeVersionv4.0"/>
    </handlers>
  </system.webServer> 

完整源代码为in my github。我跟着 microsoft documentation将我的应用部署到azure。当我在本地运行我的应用程序时,我没有错误。

2 个答案:

答案 0 :(得分:2)

  

您无权查看此目录或页面。

根本原因是Azure网站中没有默认页面。

您可以使用以下网址直接查看该页面,它应该可以正常工作。

https://{siteanme}.azurewebsites.net/views/login.html

或者您可以添加项目根文件夹中的default document,并在Azure门户网站的appsetting中将其设置为默认页面,然后保存设置。< / p>

  

默认文档是显示在网站根网址上的网页。

enter image description here

答案 1 :(得分:0)

有时您可能会将其部署在错误的位置。您可能需要将代码部署在site / wwwroot