SP2013 - Enable WCF tracing on the Search Admin Web Service (SearchAdmin.svc)

Hi Search Enthusiasts !

Today I will show you how to enable a WCF tracing on the Search Admin Web Service.

When defining your SSA, you are asked to create two application pools : one for the Search Admin Web Service (SearchAdmin.svc) and one pool for the Search Query and Site Settings (SearchService.svc)

Example

 

First step is to detect where the web service is hosted as it might not be obvious to many.   

In a PowerShell SharePoint session

$ssa = Get-SPEnterpriseSearchServiceApplication

$searchadmin = Get-SPServiceApplication -Name $ssa.Id

$searchadmin | fl *

ApplicationClassId : 52547a3d-66ed-468e-b00a-8c4a3ec7d404
ApplicationVersion : 1.0.0.0
TypeName : Search Administration Web Service Application
DisplayName : Search Administration Web Service for SSA3
IisVirtualDirectoryPath : SharePoint Web Services\287e5dc8e4954ad6828026718df34a91
ApplicationPool : SPIisWebServiceApplicationPool Name=SSA3-AdminPool
PermissionsLink : Microsoft.SharePoint.Administration.SPAdministrationLink
Endpoints : {}
DefaultEndpoint : SPIisWebServiceEndpoint
Uri : urn:schemas-microsoft-com:sharepoint:service:287e5dc8e4954ad6828026718df34a91#authority=
                               urn:uuid:6135e21abd414917ba971a6b10f02291&authority=https://nicolasuosl7:32844/Topology/
                               topology.svc
Shared : False
Comments :
TermsOfServiceUri :
Service : SearchAdminWebService
ServiceInstances : {}
ServiceApplicationProxyGroup : SPServiceApplicationProxyGroup
ManageLink :
PropertiesLink :
CanUpgrade : True
IsBackwardsCompatible : True
NeedsUpgradeIncludeChildren : False
NeedsUpgrade : False
UpgradeContext : Microsoft.SharePoint.Upgrade.SPUpgradeContext
Name : 530fe62e-ab6e-4c04-b721-65bcf1c9943c
Id : 287e5dc8-e495-4ad6-8280-26718df34a91
Status : Online
Parent : SearchAdminWebService
Version : 2521005
Properties : {}
Farm : SPFarm Name=SharePoint15_Config
UpgradedPersistedProperties : {}
CanSelectForBackup : True
DiskSizeRequired : 0
CanSelectForRestore : True
CanRenameOnRestore : True

 

There are plenty of information available to us. I will use the endpoints to determine the hosting SP Server.

$searchadmin.Endpoints | fl *

Uri : urn:schemas-microsoft-com:sharepoint:service:287e5dc8e4954ad6828026718df34a91#authority=u
                              rn:uuid:6135e21abd414917ba971a6b10f02291&authority=https://nicolasuosl7:32844/Topology/to
                              pology.svc
ListenUris : {https://nicolasuosl7:32844/287e5dc8e4954ad6828026718df34a91/SearchAdmin.svc}
TypeName : Service application endpoint
Name :
DisplayName :
Id : 5415a4bd-ac26-4326-98aa-ad5fe51502ed
Status : Online
Parent : SearchAdminWebServiceApplication Name=530fe62e-ab6e-4c04-b721-65bcf1c9943c
Version : 2520991
Properties : {}
Farm : SPFarm Name=SharePoint15_Config
UpgradedPersistedProperties : {}
CanSelectForBackup : False
DiskSizeRequired : 0
CanSelectForRestore : False
CanRenameOnRestore : False

 

Great so our SearchAdmin.svc is hosted there : https://nicolasuosl7:32844/287e5dc8e4954ad6828026718df34a91/SearchAdmin.svc

 

Note that there is only one SearchAdmin.svc throughout your farm unless the SQSS aka SearchService.svc which is deployed on all APPS.  

 

Enable some WCF tracing

Remote connect to the hosting SP server  (in my example it is nicolasuosl7)

Edit the file C:\Program Files\Microsoft Office Servers\15.0\WebServices\SearchAdmin\web.config

Add the below section in the configuration root.

   <system.diagnostics>
      <sources>
            <source name="System.ServiceModel"
                    switchValue="Information, ActivityTracing"
                    propagateActivity="true">
            <listeners>
               <add name="traceListener"
                   type="System.Diagnostics.XmlWriterTraceListener"
                   initializeData= "C:\inetpub\wwwroot\wss\VirtualDirectories\SearchAdmin.svclog" />
            </listeners>
         </source>
      </sources>
   </system.diagnostics>

Freely adapt the full file path to your convenience. Just make sure the search service account aka the one running the SearchAdmin AppPool has fully access to it.

We now need to recycle the corresponding Application Pool so our tracing can be activate.

Recycle the corresponding AppPool

There are multiple ways of detecting the corresponding AppPool hosting our SearchAdmin.svc.

$searchadmin.ApplicationPool | fl *

 

For the sake of the demonstration, I'm choosing the UI way for convenience.

https://nicolasuosl7:32844/287e5dc8e4954ad6828026718df34a91/SearchAdmin.svc

Using IIS, locate the SearchAdmin Web Service in the SharePoint Web Services site.

Note the Application Pool guid.

Go the Application Pools section and recycle the matching pool.

 

Test the WCF tracing

To validate that the tracing is active, from the hosting SP Server, open your IE browser and hit the WS URL

https://nicolasuosl7:32844/287e5dc8e4954ad6828026718df34a91/SearchAdmin.svc

You should see the .svclog file appearing in the directory C:\inetpub\wwwroot\wss\VirtualDirectories\SearchAdmin.svclog on that same server .

Et Voila !