Dot-Net
Ninject WCF 擴展 ArgumentNullException 使用 NET.TCP 綁定
我有一個配置為使用 wsHttpBinding 和 netTcpBinding 的 2 個端點的 WCF 4 服務。我使用 WAS 在 IIS 7.5 中託管該服務,並使用 Ninject WCF 擴展將 DI 引入我的服務。當我使用 wsHttpBinding 端點呼叫我的服務時,我的服務工作正常,但在我使用 netTcpBinding 時失敗。當我查看我的應用程序事件日誌時,我收到下面概述的以下錯誤。
我曾嘗試在 VS2010 中調試該問題,但在這方面進展緩慢。如果可能的話,我不想從我的 WCF 服務中刪除 Ninject。我知道我可以只使用 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有沒有人可以幫助解決這個問題?對此的任何幫助將不勝感激。
如果我是正確的,我認為您可能使用的是使用
KernelContainer. 您需要Kernel在KernelContainer. 看:
查看Google新聞組中相同問題的答案:http ://groups.google.com/group/ninject/browse_thread/thread/54108ef9e848b8f0