Reputation: 15598
I have an interface:
[ServiceBehavior]
public interface ICartService
{
string DaoString {get;set;}
public GetString();
}
and a class:
public class BigCartService:ICartService
{
public string DaoString {get;set;}
CallPrivateMethod(DaoString);
}
Using Spring.Net, I have set the object as:
<object id="bigcart" singleton="false" type="Cart.BigCartService, Cart">
<property name="DaoString" value="1"/>
</object>
How do I host it in Windows Console Application?
Upvotes: 2
Views: 948
Reputation: 1183
Check the WCF quick start (The project 'Spring.WcfQuickStart.ServerApp')
You have to way to do that :
1) Using Spring's IoC container
<object id="bigCartHost" type="Spring.ServiceModel.Activation.ServiceHostFactoryObject, Spring.Services">
<property name="TargetName" value="bigCart" />
</object>
ContextRegistry.GetContext(); // Force Spring to load configuration
Console.Out.WriteLine("Server listening...");
Console.Out.WriteLine("--- Press <return> to quit ---");
Console.ReadLine();
2) Programmatically
using (SpringServiceHost serviceHost = new SpringServiceHost("calculator"))
{
serviceHost.Open();
Console.Out.WriteLine("Server listening...");
Console.Out.WriteLine("--- Press <return> to quit ---");
Console.ReadLine();
}
Upvotes: 3