1. How to host wcf programmatically ?
Ans. using (ServiceHost Svchost = new ServiceHost(typeof(SampleServiceNamespace.SampleService)))
Console.WriteLine("Service up and running at:");
foreach (var x in host.Description.Endpoints)
2. What is the ServiceHost tag in wcf?
Ans. <%@ ServiceHost Service="DemoService.TestService" %>
To view this, right click on ".svc" file and click on "ViewMarkup".
3. Tell me about tracing in wcf?
Ans. Tracing is disabled by default. So we need To activate tracing manually in config file.
First we must create a trace listener and set a trace level other than "Off" for the selected trace source in configuration.
If we do not specify a listener, tracing is automatically disabled.
If a listener is defined, but no level is specified, the level is set to "Off" by default, which means that no trace is emitted.
4. How many files types are supported by service trace viewer in wcf?
Ans. The Service Trace Viewer supports three file types:
1. WCF Tracing File (.svcLog)
2. Event Tracing File (.etl)
3. Crimson Tracing File
5. Where can I find the servicetraceview tool?
Ans. You can find the tool at following locations,
C:\Program Files\Microsoft SDKs\Windows\v6.0\Bin
C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools (For .net 4.0)
6. How many files types the service trace viewer tool is associated with?
Ans. The Service Trace Viewer tool can be associate with two file types: .svclog and .stvproj.
7. What are the parameters used to associate the file extensions ".svclog" and ".stvproj" with SvcTraceViewer.exe?
Ans. You can use two parameters like "/register" and "/unregister" in command line to register and unregister the file extensions.
8. Can we add service host? how?
Ans. yes, we can add service host to project.
Steps: right click on project --> Add "new item"
--> Select "Text file" --> Rename the file with ".svc"(example, testservice.svc)
--> Add the <% ServiceHost %> tag with service name attribute equal to target service.