WCF включаем трассировку

http://msdn.microsoft.com/ru-ru/library/ms732023(v=vs.110).aspx

В web.config

1) Добавлям секцию
<system.diagnostics>
     <sources>
       <source name="System.ServiceModel.MessageLogging">
         <listeners>
           <add name="messages"
           type="System.Diagnostics.XmlWriterTraceListener"
           initializeData="WCFLog.svclog" />
         </listeners>
       </source>
     </sources>
   </system.diagnostics>

2) в секцию system.serviceModel добавлям
<diagnostics>
       <messageLogging
            logEntireMessage="true"
            logMalformedMessages="false"
            logMessagesAtServiceLevel="true"
            logMessagesAtTransportLevel="false"
            maxMessagesToLog="30000"
            maxSizeOfMessageToLog="200000"/>
     </diagnostics>
Смотреть SvcTraceViewer.exe
Если ошибка "there is no trace loaded from the file" то надо стопнуть сервис.

c# get x509 certificate from windows CA by Serial

        public static X509Certificate2 GetCertFromCA(string Thumbprint, string connection)
        {
            // Constants
            const int CV_OUT_BASE64HEADER = 0;
            const int CV_OUT_BINARY = 2;
 
            // Variables
            CERTADMINLib.CCertView certView = null;
            CERTADMINLib.IEnumCERTVIEWROW certViewRow = null;
            CERTADMINLib.IEnumCERTVIEWCOLUMN certViewColumn = null;
 
            try
            {
 
                int iColumnCount = 0;
                object objValue = null;
                StreamWriter objFile = null;
 
                // Connecting to the Certificate Authority
                certView = new CERTADMINLib.CCertView();
                //certView.OpenConnection(strServer + "\\" + strCAName);
                certView.OpenConnection(connection);
 
 
                // Get a column count and place columns into the view
                iColumnCount = certView.GetColumnCount(0);
                certView.SetResultColumnCount(iColumnCount);
 
                // Place each column in the view.
                for (int x = 0; x < iColumnCount; x++)
                {
                    certView.SetResultColumn(x);
                }
 
                // Open the View and reset the row position
                certViewRow = certView.OpenView();
                certViewRow.Reset();
 
                // Enumerate Row and Column Information
                Thumbprint = Thumbprint.Replace(" ", "");
                // Rows (one per cert) 
                for (int x = 0; certViewRow.Next() != -1; x++)
                {
                    // Columns with the info we need
                    certViewColumn = certViewRow.EnumCertViewColumn();
                    bool foundcert = false;
 
                    while (certViewColumn.Next() != -1)
                    {
                        string asdfasd = certViewColumn.GetDisplayName();
                        //Серийный номер
                        //Serial Number
 
                        if (asdfasd == "Serial Number" || asdfasd == "Серийный номер")
                        {
                            objValue = certViewColumn.GetValue(CV_OUT_BINARY);
                            string s = (string)objValue;
                            if (objValue != null)
                            {
 
                                if (Thumbprint.Contains(s))
                                {
                                    foundcert = true;
                                    certViewColumn.Reset();
                                }
                                else
                                    break;
                            }
                        }
                        else if (foundcert)
                            if (asdfasd == "Binary Certificate" || asdfasd == "Двоичный сертификат")
                            {
                                //Binary Certificate
                                //Двоичный сертификат
                                objValue = certViewColumn.GetValue(CV_OUT_BASE64HEADER);
                                if (objValue != null)
                                {
                                    // Write certificate to file
 
                                    objFile = File.CreateText("tempcert.cer");
                                    objFile.Write(objValue.ToString());
                                    objFile.Close();
                                    X509Certificate2 cert = new X509Certificate2("tempcert.cer");
                                    return cert;
                                }
                            }
 
 
                    }
                }
                return null;
            }
            finally
            {
                if (certViewColumn!=null)
                    Marshal.FinalReleaseComObject(certViewColumn);
                if (certViewRow != null)
                    Marshal.FinalReleaseComObject(certViewRow);
                if (certView != null)
                    Marshal.FinalReleaseComObject(certView);
            }
 
        }
 

iis Ошибка 503

Проделать шаги по ссылке http://mvolo.com/where-did-my-iis7-server-go-troubleshooting-503-quotservice-unavailablequot-errors/

Не забыть командную строку под админом запустить