Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/275.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 温莎城堡-缓慢调试_C#_Asp.net Mvc_Dependency Injection_Castle Windsor_Ioc Container - Fatal编程技术网

C# 温莎城堡-缓慢调试

C# 温莎城堡-缓慢调试,c#,asp.net-mvc,dependency-injection,castle-windsor,ioc-container,C#,Asp.net Mvc,Dependency Injection,Castle Windsor,Ioc Container,我最近开始从事一个使用Castle Windsor的ASP.NET MVC项目。问题是,每次我尝试调试应用程序时,这部分代码都需要几分钟来执行: protected override IController GetControllerInstance( RequestContext requestContext, Type controllerType) { if (controllerType == null) { throw new HttpExcep

我最近开始从事一个使用Castle Windsor的ASP.NET MVC项目。问题是,每次我尝试调试应用程序时,这部分代码都需要几分钟来执行:

protected override IController GetControllerInstance(
    RequestContext requestContext, Type controllerType)
{
    if (controllerType == null)
    {
        throw new HttpException(404, "some error");
    }

    // this takes long...    
    return (IController)kernel.Resolve(controllerType); 
}
如果有人遇到类似的情况,并能分享解决方案,那就太好了,因为这种情况实际上阻止了我使用调试器

我使用的是VS2012,项目在.NETFramework 4.5上,Castle.Core和Castle.Windsor的版本是3.1


编辑:
好的,我发现问题与容器无关,实际上是NLog设置的问题-在NLog.config中,我已将internalLogLevel设置为“Trace”-我将级别更改为“Error”,所有操作都顺利运行。很抱歉花时间给任何试图解决我的问题的人…

在应用程序启动期间,您是否尝试将容器加载到缓存中。我在Unity IOCno中使用这种操作,事实上,在我收到这个项目后,我没有更改任何与Castle相关的代码。这是容器注册的方式:
private static readonly IWindsorContainer=new WindsorContainer(new-XML解释器(new-ConfigResource(“Castle”);受保护的无效应用程序_Start(){/…var builder=new ContainerBuilder();builder.registerefinderconnector();_container=builder.Build();_container.SetAsElFinderResolver();WindsorConfig.Register(容器)
这会将配置文件中的所有容器加载到应用程序内存中吗?每次还是第一次都需要几分钟?我猜,您已经在Visual Studio中启用了符号服务器支持,而您的VS正在尝试下载/加载符号