Ejemplo n.º 1
0
	public static void Main ()
	{
		ServiceHost host = new MyHost (typeof (Foo));
		Binding binding = new BasicHttpBinding ();
		binding.ReceiveTimeout = TimeSpan.FromSeconds (5);
		ServiceEndpoint se = host.AddServiceEndpoint ("IFoo",
			binding, new Uri ("http://localhost:8080"));
		host.Open ();
		Console.WriteLine ("Hit [CR] key to close ...");
		Console.ReadLine ();
		host.Close ();
	}
Ejemplo n.º 2
0
	public static void Main ()
	{
		ServiceHost host = new MyHost (typeof (Foo));
		host.Description.Behaviors.Find<ServiceDebugBehavior> ()
			.IncludeExceptionDetailInFaults = true;
		Binding binding = new BasicHttpBinding ();
		binding.ReceiveTimeout = TimeSpan.FromSeconds (5);
		ServiceEndpoint se = host.AddServiceEndpoint ("IFoo",
			binding, new Uri ("http://localhost:8080"));
		host.Open ();
		Console.WriteLine ("Hit [CR] key to close ...");
		Console.ReadLine ();
		host.Close ();
	}
Ejemplo n.º 3
0
    public static void Main()
    {
        ServiceHost host    = new MyHost(typeof(Foo));
        Binding     binding = new BasicHttpBinding();

        binding.ReceiveTimeout = TimeSpan.FromSeconds(5);
        ServiceEndpoint se = host.AddServiceEndpoint("IFoo",
                                                     binding, new Uri("http://localhost:8080"));

        host.Open();
        Console.WriteLine("Hit [CR] key to close ...");
        Console.ReadLine();
        host.Close();
    }
Ejemplo n.º 4
0
	public static void Main ()
	{
		ServiceHost host = new MyHost (typeof (Foo));
		var smb = new ServiceMetadataBehavior ();
		smb.HttpGetEnabled = true;
		smb.HttpGetUrl = new Uri ("http://localhost:8080/wsdl");
		host.Description.Behaviors.Add (smb);
		Binding binding = new BasicHttpBinding ();
		binding.ReceiveTimeout = TimeSpan.FromSeconds (5);
		ServiceEndpoint se = host.AddServiceEndpoint ("IFoo",
			binding, new Uri ("http://localhost:8080"));
		host.Open ();
		Console.WriteLine ("Hit [CR] key to close ...");
		Console.ReadLine ();
		host.Close ();
	}
Ejemplo n.º 5
0
    public static void Main()
    {
        ServiceHost host = new MyHost(typeof(Foo));

        host.Description.Behaviors.Find <ServiceDebugBehavior> ()
        .IncludeExceptionDetailInFaults = true;
        Binding binding = new BasicHttpBinding();

        binding.ReceiveTimeout = TimeSpan.FromSeconds(5);
        ServiceEndpoint se = host.AddServiceEndpoint("IFoo",
                                                     binding, new Uri("http://localhost:8080"));

        host.Open();
        Console.WriteLine("Hit [CR] key to close ...");
        Console.ReadLine();
        host.Close();
    }
Ejemplo n.º 6
0
    public static void Main()
    {
        ServiceHost host = new MyHost(typeof(Foo));
        var         smb  = new ServiceMetadataBehavior();

        smb.HttpGetEnabled = true;
        smb.HttpGetUrl     = new Uri("http://localhost:8080");
        host.Description.Behaviors.Add(smb);
        Binding binding = new BasicHttpBinding();

        binding.ReceiveTimeout = TimeSpan.FromSeconds(5);
        ServiceEndpoint se = host.AddServiceEndpoint("IFoo",
                                                     binding, new Uri("http://localhost:8080"));

        host.Open();
        Console.WriteLine("Hit [CR] key to close ...");
        Console.ReadLine();
        host.Close();
    }
Ejemplo n.º 7
0
	public static void Main ()
	{
		ServiceHost host = new MyHost (typeof (Foo));
		var sc = new ServiceCredentials ();
		sc.UserNameAuthentication.UserNamePasswordValidationMode =
			UserNamePasswordValidationMode.Custom;
		sc.UserNameAuthentication.CustomUserNamePasswordValidator =
			UserNamePasswordValidator.None;
		host.Description.Behaviors.Add (sc);
		var binding = new BasicHttpBinding ();
		binding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly;
		binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic;
		binding.ReceiveTimeout = TimeSpan.FromSeconds (5);
		host.AddServiceEndpoint ("IFoo", binding, new Uri ("http://localhost:8080"));
		host.Open ();
		Console.WriteLine ("Hit [CR] key to close ...");
		Console.ReadLine ();
		host.Close ();
	}
Ejemplo n.º 8
0
    public static void Main()
    {
        ServiceHost host = new MyHost(typeof(Foo));
        var         sc   = new ServiceCredentials();

        sc.UserNameAuthentication.UserNamePasswordValidationMode =
            UserNamePasswordValidationMode.Custom;
        sc.UserNameAuthentication.CustomUserNamePasswordValidator =
            UserNamePasswordValidator.None;
        host.Description.Behaviors.Add(sc);
        var binding = new BasicHttpBinding();

        binding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly;
        binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic;
        binding.ReceiveTimeout = TimeSpan.FromSeconds(5);
        host.AddServiceEndpoint("IFoo", binding, new Uri("http://localhost:8080"));
        host.Open();
        Console.WriteLine("Hit [CR] key to close ...");
        Console.ReadLine();
        host.Close();
    }