Re: self hosting using wcffacility

34 views
Skip to first unread message

Craig Neuwirt

unread,
Nov 18, 2012, 8:16:44 AM11/18/12
to castle-pro...@googlegroups.com
Are you certain your implementation dependencies are satisfied?  If not, the ServiceHost will not start.  Trying resolving the implementation class from the container directly

Sent from my iPhone

On Nov 17, 2012, at 11:39 PM, Cidolfus <thelou...@gmail.com> wrote:

I have a basic Contracts project:

[ServiceContract]
public interface IEchoService
{
    [OperationContract]
    string GetUpper(string text);
    [OperationContract]
    string GetLower(string text);
}

Service project:

public class EchoService : IEchoService
{
    public string GetUpper(string text)
    {
        return text.ToUpper();
    }

    public string GetLower(string text)
    {
        return text.ToLower();
    }
}

Self host project:

class Program
{
    static void Main(string[] args)
    {
        var container = new WindsorContainer();
        container.AddFacility<WcfFacility>(f => f.CloseTimeout = TimeSpan.Zero);

        container
            .Register(
                AllTypes
                    .FromThisAssembly()
                    .InSameNamespaceAs<IEchoService>()
                    .WithServiceDefaultInterfaces()
                    .Configure(c =>
                               c.Named(c.Implementation.Name)
                                   .AsWcfService(
                                       new DefaultServiceModel()
                                           .AddEndpoints(WcfEndpoint
                                                             .BoundTo(new NetTcpBinding(SecurityMode.None))
                                                             .At(string.Format(
                                                                 "net.tcp://localhost:10333/MyServices/{0}",
                                                                 c.Implementation.Name)
                                                             )))));
        Console.WriteLine("hosting...");
        while (Console.ReadKey().Key != ConsoleKey.Q)
        {
        }
    }

When I tried connecting to my service from my client, I get this error msg:

Could not connect to net.tcp://localhost:10333/MyServices/EchoService. The connection attempt lasted for a time span of 00:00:02.0904037. TCP error code 10061: No connection could be made because the target machine actively refused it 127.0.0.1:10333.

So I checked netstat, and found out that my console service, while able to run, isn't even listening on port 10333. I have no other programs using that port, I have even changed to a few other port nubmers, but it just doesn't show up on netstat.

What could be wrong with my console service? or any configuration settings I might have missed out?

--
You received this message because you are subscribed to the Google Groups "Castle Project Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/castle-project-users/-/9OK0LBzkEs8J.
To post to this group, send email to castle-pro...@googlegroups.com.
To unsubscribe from this group, send email to castle-project-u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=en.
Reply all
Reply to author
Forward
0 new messages