简体   繁体   English

使用NET.TCP绑定的Ninject WCF扩展ArgumentNullException

[英]Ninject WCF Extension ArgumentNullException using NET.TCP Binding

I have a WCF 4 service with 2 endpoints configured to use wsHttpBinding and netTcpBinding. 我有一个WCF 4服务,其中2个端点配置为使用wsHttpBinding和netTcpBinding。 I am hosting the service within IIS 7.5 using WAS and am using the Ninject WCF extension to DI into my service. 我使用WAS在IIS 7.5中托管服务,并使用Ninject WCF扩展到DI进入我的服务。 My service works fine when I use the wsHttpBinding endpoint to call my service but fails when I use the netTcpBinding. 当我使用wsHttpBinding端点来调用我的服务但是当我使用netTcpBinding时失败,我的服务工作正常。 When I look in my Application Event Log I get the following error outlined below. 当我查看我的应用程序事件日志时,我收到以下错误。

I have tried debugging the problem in VS2010 but am getting nowhere fast with this. 我已经尝试在VS2010中调试这个问题,但是这个问题无处可寻。 I don't want to have to remove Ninject from my WCF service if at all possible. 如果可能的话,我不想从我的WCF服务中删除Ninject。 I understand that I could just use wsHttpBinding but I this is an internal service and I want to get the performance gains that netTcpBindings provide. 我知道我可以使用wsHttpBinding,但我这是一个内部服务,我想获得netTcpBindings提供的性能提升。

WebHost failed to process a request.
 Sender Information: System.ServiceModel.ServiceHostingEnvironment+HostingManager/30180123
 Exception: System.ServiceModel.ServiceActivationException: The service '/ProfileService.svc' cannot be activated due to an exception during compilation.  The exception message is: Cannot be null
Parameter name: root. ---> System.ArgumentNullException: Cannot be null
Parameter name: root
   at Ninject.Infrastructure.Ensure.ArgumentNotNull(Object argument, String name) in c:\Projects\Ninject\ninject\src\Ninject\Infrastructure\Ensure.cs:line 20
   at Ninject.ResolutionExtensions.Get[T](IResolutionRoot root, IParameter[] parameters) in c:\Projects\Ninject\ninject\src\Ninject\Syntax\ResolutionExtensions.cs:line 37
   at System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses)
   at System.ServiceModel.ServiceHostingEnvironment.HostingManager.CreateService(String normalizedVirtualPath)
   at System.ServiceModel.ServiceHostingEnvironment.HostingManager.ActivateService(String normalizedVirtualPath)
   at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath)
   --- End of inner exception stack trace ---
   at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath)
   at System.ServiceModel.ServiceHostingEnvironment.EnsureServiceAvailableFast(String relativeVirtualPath)
 Process Name: w3wp
 Process ID: 8656

Is there anybody out there that may be able to help with this problem? 有没有人可以帮助解决这个问题? Any help on this one would be much appreciated. 对此的任何帮助将不胜感激。

If I'm correct, I reckon you may be using an older version which uses the KernelContainer . 如果我是正确的,我估计您可能正在使用使用KernelContainer的旧版本。 You need to set the Kernel on the KernelContainer . 您需要在KernelContainer上设置Kernel See: 看到:

https://github.com/ninject/ninject.extensions.wcf/blob/52bb83728774701ec42b5f76b096bec934dfe419/src/Ninject.Extensions.Wcf/KernelContainer.cs https://github.com/ninject/ninject.extensions.wcf/blob/52bb83728774701ec42b5f76b096bec934dfe419/src/Ninject.Extensions.Wcf/KernelContainer.cs

请参阅Google新闻组中相同问题的答案: http//groups.google.com/group/ninject/browse_thread/thread/54108ef9e848b8f0

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM