Php 在azure上部署Symfony2应用程序导致404错误(哎呀!发生了一个错误,服务器返回了一个“404未找到”)

Php 在azure上部署Symfony2应用程序导致404错误(哎呀!发生了一个错误,服务器返回了一个“404未找到”),php,symfony,azure,web-config,Php,Symfony,Azure,Web Config,Backgorund D:\home\site\wwwroot\btrfly>php app/console debug:route -------------------------- -------- -------- ------ ----------------------------------- Name Method Scheme Host Path

Backgorund

    D:\home\site\wwwroot\btrfly>php app/console debug:route
 -------------------------- -------- -------- ------ ----------------------------------- 
  Name                       Method   Scheme   Host   Path                               
 -------------------------- -------- -------- ------ ----------------------------------- 
  _wdt                       ANY      ANY      ANY    /_wdt/{token}                      
  _profiler_home             ANY      ANY      ANY    /_profiler/                        
  _profiler_search           ANY      ANY      ANY    /_profiler/search                  
  _profiler_search_bar       ANY      ANY      ANY    /_profiler/search_bar              
  _profiler_purge            ANY      ANY      ANY    /_profiler/purge                   
  _profiler_info             ANY      ANY      ANY    /_profiler/info/{about}            
  _profiler_phpinfo          ANY      ANY      ANY    /_profiler/phpinfo                 
  _profiler_search_results   ANY      ANY      ANY    /_profiler/{token}/search/results  
  _profiler                  ANY      ANY      ANY    /_profiler/{token}                 
  _profiler_router           ANY      ANY      ANY    /_profiler/{token}/router          
  _profiler_exception        ANY      ANY      ANY    /_profiler/{token}/exception       
  _profiler_exception_css    ANY      ANY      ANY    /_profiler/{token}/exception.css   
  _twig_error_test           ANY      ANY      ANY    /_error/{code}.{_format}           
  home                       ANY      ANY      ANY    /                                  
  btrfly                     ANY      ANY      ANY    /btrfly                            
 -------------------------- -------- -------- ------ ----------------------------------- 


    D:\home\site\wwwroot\btrfly>php app/console router:match /btrfly


 [OK] Route "btrfly" matches                                                                                           

+--------------+---------------------------------------------------------+
| Property     | Value                                                   |
+--------------+---------------------------------------------------------+
| Route Name   | btrfly                                                  |
| Path         | /btrfly                                                 |
| Path Regex   | #^/btrfly$#s                                            |
| Host         | ANY                                                     |
| Host Regex   |                                                         |
| Scheme       | ANY                                                     |
| Method       | ANY                                                     |
| Requirements | NO CUSTOM                                               |
| Class        | Symfony\Component\Routing\Route                         |
| Defaults     | _controller: AppBundle:Default:btrfly                   |
| Options      | compiler_class: Symfony\Component\Routing\RouteCompiler |
+--------------+---------------------------------------------------------+
我是symfony应用程序开发的新手

symfony(版本2.8)的新副本已安装并通过git部署到azure。应用程序正在子目录(即)中运行。一切正常,我可以浏览它(url:)。正如symfony教程中建议的那样,我想从url中删除
web/app.php

问题

当我使用上述symfony教程中给出的配置代码在
btrfly
文件夹中添加
web.config
文件时,会出现以下错误:

哎呀!发生了一个错误

服务器返回“404未找到”

有东西坏了。请让我们知道当这一切发生时你在做什么 发生错误。我们会尽快修好的。对不起 造成不便

我已经检查了
app/logs/prod.log
以了解详细信息,并发现以下错误:

[2015-12-30 14:43:50]请求。错误:未捕获的PHP异常 Symfony\Component\HttpKernel\Exception\NotFoundHttpException:“否 在找到“GET/btrfly/”的路由 D:\home\site\wwwroot\btrfly\vendor\symfony\symfony\src\symfony\Component\HttpKernel\EventListener\RouterListener.php 第176行{“例外”:“[对象] (Symfony\Component\HttpKernel\Exception\NotFoundHttpException(代码: 0):在上找不到“GET/btrfly/\”的路由 D:\home\site\wwwroot\btrfly\vendor\symfony\symfony\src\symfony\Component\HttpKernel\EventListener\RouterListener.php:176, Symfony\Component\Routing\Exception\ResourceNotFoundException(代码: 0):在 D:\home\site\wwwroot\btrfly\app\cache\prod\appProdUrlMatcher.php:48“} []

第1页。我已清除prod缓存

  • 选中了php应用程序/控制台调试:路由器。有一条指向
    /
    细分线路

  • routing.yml
    看起来不错

  • 这几天完全迷失了方向。如果有可能的话,在网上到处冲浪。不知道出了什么问题。非常感谢任何形式的帮助或指导

    已编辑

        D:\home\site\wwwroot\btrfly>php app/console debug:route
     -------------------------- -------- -------- ------ ----------------------------------- 
      Name                       Method   Scheme   Host   Path                               
     -------------------------- -------- -------- ------ ----------------------------------- 
      _wdt                       ANY      ANY      ANY    /_wdt/{token}                      
      _profiler_home             ANY      ANY      ANY    /_profiler/                        
      _profiler_search           ANY      ANY      ANY    /_profiler/search                  
      _profiler_search_bar       ANY      ANY      ANY    /_profiler/search_bar              
      _profiler_purge            ANY      ANY      ANY    /_profiler/purge                   
      _profiler_info             ANY      ANY      ANY    /_profiler/info/{about}            
      _profiler_phpinfo          ANY      ANY      ANY    /_profiler/phpinfo                 
      _profiler_search_results   ANY      ANY      ANY    /_profiler/{token}/search/results  
      _profiler                  ANY      ANY      ANY    /_profiler/{token}                 
      _profiler_router           ANY      ANY      ANY    /_profiler/{token}/router          
      _profiler_exception        ANY      ANY      ANY    /_profiler/{token}/exception       
      _profiler_exception_css    ANY      ANY      ANY    /_profiler/{token}/exception.css   
      _twig_error_test           ANY      ANY      ANY    /_error/{code}.{_format}           
      home                       ANY      ANY      ANY    /                                  
      btrfly                     ANY      ANY      ANY    /btrfly                            
     -------------------------- -------- -------- ------ ----------------------------------- 
    
    
        D:\home\site\wwwroot\btrfly>php app/console router:match /btrfly
    
    
     [OK] Route "btrfly" matches                                                                                           
    
    +--------------+---------------------------------------------------------+
    | Property     | Value                                                   |
    +--------------+---------------------------------------------------------+
    | Route Name   | btrfly                                                  |
    | Path         | /btrfly                                                 |
    | Path Regex   | #^/btrfly$#s                                            |
    | Host         | ANY                                                     |
    | Host Regex   |                                                         |
    | Scheme       | ANY                                                     |
    | Method       | ANY                                                     |
    | Requirements | NO CUSTOM                                               |
    | Class        | Symfony\Component\Routing\Route                         |
    | Defaults     | _controller: AppBundle:Default:btrfly                   |
    | Options      | compiler_class: Symfony\Component\Routing\RouteCompiler |
    +--------------+---------------------------------------------------------+
    

    “选中php应用程序/控制台调试:路由器。有一条指向
    /
    的subdir路由”是什么意思?根据日志,您需要有一个指向
    /subdir
    @xabbuh的路由对不起,我的坏消息。是的,我是说是的,它指向
    /subdir
    。还是一样的错误。猜猜看?你能不能显示
    php应用程序/控制台调试:router的输出,其中
    是该路由的名称?您还可以显示
    php应用程序/控制台路由器:match/subdir
    的输出吗?正如您在路由器命令的输出中所看到的,没有路由处理对
    /subdir
    路径的请求(名为
    subdir
    的路由的路径是
    //code>)。您可能希望为带有尾部斜杠的请求引入重定向,如cookbook中所述:“checked php app/console debug:router”的意思是什么。有一个指向
    /
    的subdir路由?根据日志,您需要有一个指向
    /subdir
    @xabbuh的路由对不起,我的坏消息。是的,我是说是的,它指向
    /subdir
    。还是一样的错误。猜猜看?你能不能显示
    php应用程序/控制台调试:router的输出,其中
    是该路由的名称?您还可以显示
    php应用程序/控制台路由器:match/subdir
    的输出吗?正如您在路由器命令的输出中所看到的,没有路由处理对
    /subdir
    路径的请求(名为
    subdir
    的路由的路径是
    //code>)。您可能希望为带有尾部斜杠的请求引入重定向,如烹饪书中所述: