(NOTES) NOTES (2021)

How to make WCF service public with Visual Studio, add SSL and debug WCF SSL REST service.

1. Make WCF service public.

If you use IISexpress, your WCF service will be can not accessible from other computer. This is big trouble if you need access to WCF REST service from another computer.

To resolve this trouble need to switch from IIS express to IIS.

After that Virtual nodes in IIS will be created and WCF-service will be accessible from another computer.

Pay attention how IIS virtual nodes define. Look to .VS folder and applicationhost.config file.

Big issue with this tuning, that project will be not loading again into Visual Studio. This issue has been repeated in my environment always.

But project can be simple restored by delete reference to IIS node.

2. Add SSL to WCF service.

Goal of this process is force IIS working with SSL, by HTTPS.

By default, IIS has autogenerated certificates with wrong ID.

Therefore we need upload to IIS any valid machine certificates with private key. For example, I have installed Fiddler, and this program has right certificate.

To support SSL in IIS need to select this certificate.

To avoid any warning the best way is export this certificate and import it on computer from you will test WCF service.

3. Debug WCF SSL REST service.

There are a lot of way to decrypt SSL and debug SSL WCF services. First way is Wireshark network sniffer , for example this is a guide Decrypting SSL/TLS Traffic with Wireshark, but there are a some restrictions of wireshark decription wireshark restriction TSL.

So, is site started with IIS Express and Visual studio simplest method is HttpHandler - BeginRequest.

if you have access to IIS, the simplest and best way to trace get parameters is IIS log.

But, of course, this is possible only to simplest GET request. In practice, of course WCF services has more complex and sophisticated structure. Therefor WCF services has special tracer.

This tracer can be activated by:

   1:  <?xml version="1.0"  encoding="utf-8"?>
   2:  <configuration>
   3:      <system.diagnostics>
   4:          <sources>
   5:              <source name="System.ServiceModel"  switchValue="Information, ActivityTracing" propagateActivity="true">
   6:                  <listeners>
   7:                      <add name="traceListener"  type="System.Diagnostics.XmlWriterTraceListener" initializeData="J:\WcfTrace\Trace.svclog"  />
   8:                  </listeners>
   9:              </source>
  10:          </sources>
  11:      </system.diagnostics>
  12:      <connectionStrings>
  13:      ...

Also Visual Studio has WcfTestClient, but it working only with SOAP/WSDL structure.

And couple of words about composer for testing. There are a lot of composers, for example Postman and SoapUI, but I prefer Fiddler as more advanced and complex solution. For example in this screen you can see how Microsoft steal information from your computer.

If you use Fiddler, to perform local service need to use URL ipv4.fiddler, also pay attention hay WCF rest service return XML to browser or JSON to composer.

And, of course, you can use C:\Windows\System32\drivers\etc or /etc/host to redirect all traffic to your developer IIS server with WCF.

Comments ( )
<00>  <01>  <02>  <03>  <04>  <05>  <06>  <07>  <08>  <09>  <10>  <11>  <12>  <13>  <14>  <15>  <16>  <17>  <18>  <19>  <20>  <21>  <22>  <23
Link to this page: //www.vb-net.com/WCF-public/Index.htm