gpt4 book ai didi

php - 交响乐 4 : You have requested a non-existent service

转载 作者:行者123 更新时间:2023-12-05 08:18:55 24 4
gpt4 key购买 nike

我将我的网站从 Symfony 3.4 更新到 Symfony 4 并做了一点改动。但是知道我有这个错误:

您请求了一个不存在的服务“D”。

这是我的堆栈跟踪:

Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException:
You have requested a non-existent service "D".

at vendor\symfony\dependency-injection\Container.php:263
at Symfony\Component\DependencyInjection\Container->get('D')
(vendor\symfony\routing\Loader\DependencyInjection\ServiceRouterLoader.php:38)
at Symfony\Component\Routing\Loader\DependencyInjection\ServiceRouterLoader->getServiceObject('D')
(vendor\symfony\routing\Loader\ObjectRouteLoader.php:55)
at Symfony\Component\Routing\Loader\ObjectRouteLoader->load('D:\\IIS Websites\\Wizard\\src/config/routing.yml', 'service')
(vendor\symfony\config\Loader\DelegatingLoader.php:40)
at Symfony\Component\Config\Loader\DelegatingLoader->load('D:\\IIS Websites\\Wizard\\src/config/routing.yml', 'service')
(vendor\symfony\framework-bundle\Routing\DelegatingLoader.php:70)
at Symfony\Bundle\FrameworkBundle\Routing\DelegatingLoader->load('D:\\IIS Websites\\Wizard\\src/config/routing.yml', 'service')
(vendor\symfony\framework-bundle\Routing\Router.php:56)
at Symfony\Bundle\FrameworkBundle\Routing\Router->getRouteCollection()
(vendor\symfony\routing\Router.php:367)
at Symfony\Component\Routing\Router->getMatcherDumperInstance()
(vendor\symfony\routing\Router.php:289)
at Symfony\Component\Routing\Router->Symfony\Component\Routing\{closure}(object(ResourceCheckerConfigCache))
at call_user_func(object(Closure), object(ResourceCheckerConfigCache))
(vendor\symfony\config\ResourceCheckerConfigCacheFactory.php:43)
at Symfony\Component\Config\ResourceCheckerConfigCacheFactory->cache('D:\\IIS Websites\\Wizard\\var\\cache\\dev/srcDevDebugProjectContainerUrlMatcher.php', object(Closure))
(vendor\symfony\routing\Router.php:302)
at Symfony\Component\Routing\Router->getMatcher()
(vendor\symfony\routing\Router.php:256)
at Symfony\Component\Routing\Router->matchRequest(object(Request))
(vendor\symfony\http-kernel\EventListener\RouterListener.php:109)
at Symfony\Component\HttpKernel\EventListener\RouterListener->onKernelRequest(object(GetResponseEvent), 'kernel.request', object(EventDispatcher))
(vendor\symfony\event-dispatcher\EventDispatcher.php:212)
at Symfony\Component\EventDispatcher\EventDispatcher->doDispatch(array(array(object(DebugHandlersListener), 'configure'), array(object(ValidateRequestListener), 'onKernelRequest'), array(object(SessionListener), 'onKernelRequest'), array(object(FragmentListener), 'onKernelRequest'), array(object(RouterListener), 'onKernelRequest'), array(object(ResolveControllerNameSubscriber), 'onKernelRequest'), array(object(LocaleListener), 'onKernelRequest'), array(object(TranslatorListener), 'onKernelRequest'), array(object(TraceableFirewallListener), 'onKernelRequest')), 'kernel.request', object(GetResponseEvent))
(vendor\symfony\event-dispatcher\EventDispatcher.php:44)
at Symfony\Component\EventDispatcher\EventDispatcher->dispatch('kernel.request', object(GetResponseEvent))
(vendor\symfony\http-kernel\HttpKernel.php:125)
at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1)
(vendor\symfony\http-kernel\HttpKernel.php:66)
at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true)
(vendor\symfony\http-kernel\Kernel.php:190)
at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
(public\index.php:34)

提前感谢您的帮助。

最佳答案

我在从 Symfony 3.4 升级到 4.0 时遇到了同样的问题。我目前正在为路由使用注释,而在使用 Symfony 3 时情况并非如此。

看来我的 framework.yaml 路由器配置 (/config/packages/) 是错误的。

框架:
路由器:
资源:“%kernel.root_dir%/config/routing.yml”
严格要求:~

它实际上是从旧的 config.yml 文件复制/粘贴的。由于我正在为路由使用注释,因此在框架配置中删除路由器 key 解决了我的问题。但您可能还需要指向“资源”下的特定路由配置文件。

您可以使用以下命令检查指定的资源路径是否正确:

php bin/console debug:config framework

希望这会有所帮助!

关于php - 交响乐 4 : You have requested a non-existent service,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48090943/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com