WCF扩展ArgumentNullException使用net

WCF扩展ArgumentNullException使用net

本文介绍了Ninject WCF扩展ArgumentNullException使用net.tcp绑定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个WCF 4服务​​,配置为使用的wsHttpBinding和NetTcpBinding的2端点。我使用托管WAS IIS 7.5中的服务和现在用的是Ninject WCF扩展到DI为我服务。我的服务工作正常,当我使用的wsHttpBinding终点打电话给我的服务,但是当我使用NetTcpBinding的失败。当我看着我的应用程序事件日志出现以下错误概述如下。

I have a WCF 4 service with 2 endpoints configured to use wsHttpBinding and netTcpBinding. I am hosting the service within IIS 7.5 using WAS and am using the Ninject WCF extension to DI into my service. My service works fine when I use the wsHttpBinding endpoint to call my service but fails when I use the netTcpBinding. When I look in my Application Event Log I get the following error outlined below.

我试图调试在VS2010的问题,但我得到这个无处快。我不希望有,如果可能的话,从我的WCF服务中移除Ninject。我明白,我可以只使用的wsHttpBinding,但我这是一个内部服务,我想获得的性能提升netTcpBindings提供。

I have tried debugging the problem in VS2010 but am getting nowhere fast with this. I don’t want to have to remove Ninject from my WCF service if at all possible. 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.

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

有没有人在那里,也许能帮助解决这个问题?在这一个任何帮助将是非常美联社preciated。

Is there anybody out there that may be able to help with this problem? Any help on this one would be much appreciated.

推荐答案

如果我是正确的,我想你可能会使用它使用了 KernelContainer 的旧版本。您需要在 KernelContainer 设置内核。参见:

If I'm correct, I reckon you may be using an older version which uses the KernelContainer. You need to set the Kernel on the KernelContainer. See:

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

这篇关于Ninject WCF扩展ArgumentNullException使用net.tcp绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 21:12