简体   繁体   中英

How to add WSHttpBinding to NinjectServiceHostFactory

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>();
}

How do I tell the system to accept WSHttpBinding calls to IAccountService ?

Here's my .svc for reference:

<%@ ServiceHost Language="C#" Debug="true" 
    Service="AAA.AAA.AAA.WCFAccountService" 
    Factory="Ninject.Extensions.Wcf.NinjectServiceHostFactory" %>

(Note: I'm using the Ninject.Extensions.Wcf and only BasicHttpBinding seems to work 'out of the box')

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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