Wednesday, March 14, 2012
WCF Interview Question - Method to perform Self-Hosting in WCF?
The following steps are followed to do Self-hosting.
Step1: //Create a URI to serve as the base address
// Address as well binding
Uri httpUrl = new Uri("http://localhost:8010/MyService/HelloWorld");
Step2: //Create ServiceHost
ServiceHost host = new ServiceHost(typeof(ClassLibrary1.HelloWorldService),httpUrl);
Step3: //Add a service endpoint
host.AddServiceEndpoint(typeof(ClassLibrary1.IHelloWorldService) , new WSHttpBinding(), "");
Step4: //Enable metadata exchange
ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
smb.HttpGetEnabled = true;
host.Description.Behaviors.Add(smb);
Step5: //Start the Service
host.Open();
Step6:
Console.WriteLine("Service is host at " + DateTime.Now.ToString());
Console.WriteLine("Host is running... Press key to stop");
Console.ReadLine();
Subscribe to:
Post Comments (Atom)
Could not find a part of the path ... bin\roslyn\csc.exe
I am trying to run an ASP.NET MVC (model-view-controller) project retrieved from TFS (Team Foundation Server) source control. I have added a...

-
The ASP.NET MVC 4 Internet template adds some new, very useful features which are built on top of SimpleMembership. These changes add som...
-
Building Custom Controls for Windows 8 Store apps : This article explains how to build custom controls for Windows Store apps, using XAML a...
-
Building your first Windows Metro style app using C#, C++, or Visual Basic [This documentation is preliminary and is subject to change.] ...
No comments:
Post a Comment