Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.ServiceModel;
- using System.ServiceModel.Description;
- using WcfServiceContract;
- using System.Text;
- using System.Threading.Tasks;
- namespace WCFserviceHost
- {
- class Program
- {
- static void Main(string[] args)
- {
- Uri baseAddress = new Uri("http://localhost:10009/Matuszczyk");
- ServiceHost mojHost = new ServiceHost(typeof(srv107), baseAddress);
- try
- {
- WSHttpBinding mojBanding = new WSHttpBinding();
- mojHost.AddServiceEndpoint(typeof(Isrv107), mojBanding, "Isrv107");
- ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
- smb.HttpGetEnabled = true;
- mojHost.Description.Behaviors.Add(smb);
- mojHost.Open();
- Console.WriteLine("Serwis jest uruchomiony.");
- Console.WriteLine("Nacisnij <ENTER> aby zakonczyc");
- Console.WriteLine();
- mojHost.Close();
- }
- catch (CommunicationException ce)
- {
- Console.WriteLine("Wystapiol wyjatek: {0}", ce.Message);
- mojHost.Abort();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement