本文介绍了如何添加WsHttpBinding的到NinjectServiceHostFactory的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的 NinjectWebCommon 类已在运行的 App_start ,然后我结合我的WCF接口的服务是这样的:
After my NinjectWebCommon class has run in App_start I then bind my WCF interfaces to services like this:
public static void LoadModules(IKernel kernel)
{
kernel.Bind<IAccountService>().To<WCFAccountService>();
}
我如何告诉系统接受的WSHttpBinding 呼吁为 IAccountService
下面是我的.svc供参考:
Here's my .svc for reference:
<%@ ServiceHost Language="C#" Debug="true"
Service="AAA.AAA.AAA.WCFAccountService"
Factory="Ninject.Extensions.Wcf.NinjectServiceHostFactory" %>
(注:我使用的是 Ninject.Extensions.Wcf ,只有 basicHttpBinding的似乎工作'开箱即用')
(Note: I'm using the Ninject.Extensions.Wcf and only BasicHttpBinding seems to work 'out of the box')
推荐答案
您需要配置在web.config中的服务像
You need to configure the service in the web.config like
<service name="AAA.AAA.AAA.WCFAccountService" behaviorConfiguration="AAA.AAA.AAA.WCFAccountServiceBehavior">
<endpoint name="IAccountService" address="" binding="wsHttpBinding" contract="AAA.AAA.AAA.IAccountService" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
这篇关于如何添加WsHttpBinding的到NinjectServiceHostFactory的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!