Using VS2010 and .NET v4 I created a service interface that looks like this:
[ServiceContract]
public interface InterfaceTestService
{
[OperationContract]
String GetMessage();
...
And the server implementation that looks like this:
namespace TestServices
{
public class TestServices: InterfaceTestService
{
public TestServices()
{
...;
}
public String GetMessage()
{
return "TEST";
}
Works fine at its current state, but if I try to add a parameter to my initialization function:
public TestServices(int number)
I can no longer use the service and get this message:
The service type provided could not be loaded as a service because it does not have a default (parameter-less) constructor. To fix the problem, add a default constructor to the type, or pass an instance of the type to the host.
Something that makes sense, but how can I create a constructor that accepts parameters for my service?