Я получаю Последовательность без ошибок при попытке установить мои службы wcf.
вот код в моем global.asax:
_container = new WindsorContainer();
_container.Register(Component.For<IWindsorContainer>().Instance(_container))
.AddFacility<WcfFacility>()
.Install(Configuration.FromAppConfig())
.Install(FromAssembly.InDirectory(new AssemblyFilter(HttpRuntime.BinDirectory, "Web*.dll")));
вот моя система.раздел servicemodel в web.config:
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<client>
<endpoint address="http://commandservice.website.com/WebsiteCommandService.svc" binding="basicHttpBinding" contract="CommandService.IWebsiteCommandService" name="commandServiceClient"></endpoint>
</client>
</system.serviceModel>
А вот мой конфиг замка (в пределах web.config):
<castle>
<components>
<component
id="commandService"
type="CommandService.WebsiteCommandService, CommandService"
wcfEndpointConfiguration="commandServiceClient" />
</components>
</castle>
Я что-то упускаю из виду?
ОБНОВЛЕНИЕ:
Вот трассировка стека:
[InvalidOperationException: Sequence contains no elements]
System.Linq.Enumerable.Single(IEnumerable`1 source) +371
Castle.Facilities.WcfIntegration.WcfClientExtension.ObtainServiceContract(ComponentModel model, IWcfClientModel clientModel) in c:\TeamCity\buildAgent\work\a19756d977ce9d2c\src\Castle.Facilities.WcfIntegration\Client\WcfClientExtension.cs:239
Castle.Facilities.WcfIntegration.WcfClientExtension.ResolveClientModel(ComponentModel model) in c:\TeamCity\buildAgent\work\a19756d977ce9d2c\src\Castle.Facilities.WcfIntegration\Client\WcfClientExtension.cs:234
Castle.Facilities.WcfIntegration.WcfClientExtension.Kernel_ComponentModelCreated(ComponentModel model) in c:\TeamCity\buildAgent\work\a19756d977ce9d2c\src\Castle.Facilities.WcfIntegration\Client\WcfClientExtension.cs:189
Castle.MicroKernel.ComponentModelDelegate.Invoke(ComponentModel model) +0
Castle.MicroKernel.DefaultKernel.AddCustomComponent(ComponentModel model, Boolean isMetaHandler) in d:\BuildAgent\work\60b7fa65294e7792\src\Castle.Windsor\MicroKernel\DefaultKernel.cs:281
Castle.MicroKernel.DefaultKernel.Register(IRegistration[] registrations) in d:\BuildAgent\work\60b7fa65294e7792\src\Castle.Windsor\MicroKernel\DefaultKernel.cs:536
Castle.Windsor.WindsorContainer.Register(IRegistration[] registrations) in d:\BuildAgent\work\60b7fa65294e7792\src\Castle.Windsor\Windsor\WindsorContainer.cs:482
Castle.Windsor.Installer.DefaultComponentInstaller.SetUpComponents(IConfiguration[] configurations, IWindsorContainer container, IConversionManager converter) in d:\BuildAgent\work\60b7fa65294e7792\src\Castle.Windsor\Windsor\Installer\DefaultComponentInstaller.cs:211
Castle.Windsor.WindsorContainer.Install(IWindsorInstaller[] installers, DefaultComponentInstaller scope) in d:\BuildAgent\work\60b7fa65294e7792\src\Castle.Windsor\Windsor\WindsorContainer.cs:317
Castle.Windsor.WindsorContainer.Install(IWindsorInstaller[] installers) in d:\BuildAgent\work\60b7fa65294e7792\src\Castle.Windsor\Windsor\WindsorContainer.cs:453
Website.MvcApplication.ConfigureContainer() in C:\Users\Wayne Douglas\Dev\ProjectWebsite\Website\Global.asax.cs:65
Website.MvcApplication.Application_Start() in C:\Users\Wayne Douglas\Dev\ProjectWebsite\Website\Global.asax.cs:53
[HttpException (0x80004005): Sequence contains no elements]
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +4052053
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +191
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +352
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +407
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +375
[HttpException (0x80004005): Sequence contains no elements]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +11686928
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +141
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +4863749
ОБНОВЛЕНИЕ
проблема, кажется, где-то еще сейчас - это как будто он пытается решить компонент, как будтоэто был обычный объект, а не сервис wcf.Если учесть, что сервис работает - при попытке решить его с помощью wcf я получаю сообщение об ошибке на ctor:
public WebSiteCommandService(ICommandService service)
{
_service = service;
}
Он говорит, что для ICommandService нет компонента
, почемуклиентский контейнер пытается решить это?
это похоже на то, что wcffacility пропускается полностью?
Вот стек:
[InstanceNotFoundInEnvironmentConfigurationException: Could not find requested type Ncqrs.Commanding.ServiceModel.ICommandService in the NcqrsEnvironment configuration. Make sure that the NcqrsEnvironment is configured correctly or that defaults are correctly set.]
Ncqrs.NcqrsEnvironment.Get() in C:\Users\Wayne Douglas\Dev\ProjectWebsite\ThirdParty\NCQRS\src\Ncqrs\NcqrsEnvironment.cs:96
CommandService.WebsiteCommandService..cctor() in C:\Users\Wayne Douglas\Dev\ProjectWebsite\CommandService\WebsiteCommandService.svc.cs:17
[TypeInitializationException: The type initializer for 'CommandService.WebsiteCommandService' threw an exception.]
System.Runtime.Serialization.FormatterServices.nativeGetUninitializedObject(RuntimeType type) +0
Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstanceCore(ConstructorCandidate constructor, Object[] arguments, Type implType) in d:\BuildAgent\work\60b7fa65294e7792\src\Castle.Windsor\MicroKernel\ComponentActivator\DefaultComponentActivator.cs:151
[ComponentActivatorException: ComponentActivator: could not instantiate CommandService.WebsiteCommandService]
Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstanceCore(ConstructorCandidate constructor, Object[] arguments, Type implType) in d:\BuildAgent\work\60b7fa65294e7792\src\Castle.Windsor\MicroKernel\ComponentActivator\DefaultComponentActivator.cs:163
Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstance(CreationContext context, ConstructorCandidate constructor, Object[] arguments) in d:\BuildAgent\work\60b7fa65294e7792\src\Castle.Windsor\MicroKernel\ComponentActivator\DefaultComponentActivator.cs:116
Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCreate(CreationContext context) in d:\BuildAgent\work\60b7fa65294e7792\src\Castle.Windsor\MicroKernel\ComponentActivator\DefaultComponentActivator.cs:66
Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create(CreationContext context, Burden burden) in d:\BuildAgent\work\60b7fa65294e7792\src\Castle.Windsor\MicroKernel\ComponentActivator\AbstractComponentActivator.cs:80
Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.CreateInstance(CreationContext context, Boolean trackedExternally) in d:\BuildAgent\work\60b7fa65294e7792\src\Castle.Windsor\MicroKernel\Lifestyle\AbstractLifestyleManager.cs:81
Castle.MicroKernel.Lifestyle.SingletonLifestyleManager.Resolve(CreationContext context, IReleasePolicy releasePolicy) in d:\BuildAgent\work\60b7fa65294e7792\src\Castle.Windsor\MicroKernel\Lifestyle\SingletonLifestyleManager.cs:63
Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(CreationContext context, Boolean requiresDecommission, Boolean instanceRequired, Burden& burden) in d:\BuildAgent\work\60b7fa65294e7792\src\Castle.Windsor\MicroKernel\Handlers\DefaultHandler.cs:124
Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext context, Boolean instanceRequired) in d:\BuildAgent\work\60b7fa65294e7792\src\Castle.Windsor\MicroKernel\Handlers\DefaultHandler.cs:98
Castle.MicroKernel.Resolvers.DefaultDependencyResolver.ResolveCore(CreationContext context, ComponentModel model, DependencyModel dependency) in d:\BuildAgent\work\60b7fa65294e7792\src\Castle.Windsor\MicroKernel\Resolvers\DefaultDependencyResolver.cs:308
Castle.MicroKernel.Resolvers.DefaultDependencyResolver.Resolve(CreationContext context, ISubDependencyResolver contextHandlerResolver, ComponentModel model, DependencyModel dependency) in d:\BuildAgent\work\60b7fa65294e7792\src\Castle.Windsor\MicroKernel\Resolvers\DefaultDependencyResolver.cs:158
Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateConstructorArguments(ConstructorCandidate constructor, CreationContext context) in d:\BuildAgent\work\60b7fa65294e7792\src\Castle.Windsor\MicroKernel\ComponentActivator\DefaultComponentActivator.cs:292
Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.Instantiate(CreationContext context) in d:\BuildAgent\work\60b7fa65294e7792\src\Castle.Windsor\MicroKernel\ComponentActivator\DefaultComponentActivator.cs:85
Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCreate(CreationContext context) in d:\BuildAgent\work\60b7fa65294e7792\src\Castle.Windsor\MicroKernel\ComponentActivator\DefaultComponentActivator.cs:66
Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create(CreationContext context, Burden burden) in d:\BuildAgent\work\60b7fa65294e7792\src\Castle.Windsor\MicroKernel\ComponentActivator\AbstractComponentActivator.cs:80
Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.CreateInstance(CreationContext context, Boolean trackedExternally) in d:\BuildAgent\work\60b7fa65294e7792\src\Castle.Windsor\MicroKernel\Lifestyle\AbstractLifestyleManager.cs:81
Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.Resolve(CreationContext context, IReleasePolicy releasePolicy) in d:\BuildAgent\work\60b7fa65294e7792\src\Castle.Windsor\MicroKernel\Lifestyle\AbstractLifestyleManager.cs:70
Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(CreationContext context, Boolean requiresDecommission, Boolean instanceRequired, Burden& burden) in d:\BuildAgent\work\60b7fa65294e7792\src\Castle.Windsor\MicroKernel\Handlers\DefaultHandler.cs:124
Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext context, Boolean instanceRequired) in d:\BuildAgent\work\60b7fa65294e7792\src\Castle.Windsor\MicroKernel\Handlers\DefaultHandler.cs:98
Castle.MicroKernel.DefaultKernel.ResolveComponent(IHandler handler, Type service, IDictionary additionalArguments, IReleasePolicy policy) in d:\BuildAgent\work\60b7fa65294e7792\src\Castle.Windsor\MicroKernel\DefaultKernel.cs:777
Castle.MicroKernel.DefaultKernel.Castle.MicroKernel.IKernelInternal.Resolve(Type service, IDictionary arguments, IReleasePolicy policy) in d:\BuildAgent\work\60b7fa65294e7792\src\Castle.Windsor\MicroKernel\DefaultKernel_Resolve.cs:225
Website.WindsorControllerFactory.GetControllerInstance(RequestContext requestContext, Type controllerType) in C:\Users\Wayne Douglas\Dev\ProjectWebsite\Website\WindsorControllerFactory.cs:24
System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName) +93
System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController& controller, IControllerFactory& factory) +346
System.Web.Mvc.<>c__DisplayClass6.<BeginProcessRequest>b__2() +71
System.Web.Mvc.<>c__DisplayClassb`1.<ProcessInApplicationTrust>b__a() +19
System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Func`1 func) +161
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +405
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +375