Вход в SQL Azure с использованием Enterprise Library 5 работает с компьютера разработчика, но не с веб-роли - PullRequest
1 голос
/ 20 марта 2012

Я использую SQL Azure в качестве репозитория журналов, используя корпоративную библиотеку 5. Я запускаю полный интеграционный тест со своего собственного компьютера, используя все строки подключения развертывания и строки подключения db azure, и пытаюсь записать журнал в БД.Это отлично работает!

Но при активном развертывании в промежуточной среде и попытке записи в журнал не возникает никаких исключений, но журнал также не записывается.

Вот мои соответствующие разделы app.config:

 <?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
    <section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" />
  </configSections>
  <loggingConfiguration name="" tracingEnabled="true" defaultCategory="MainLogger"
      revertImpersonation="false">
    <listeners>
      <add name="LoggingDb" type="Microsoft.Practices.EnterpriseLibrary.Logging.Database.FormattedDatabaseTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging.Database, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
          listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Database.Configuration.FormattedDatabaseTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging.Database, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
          databaseInstanceName="LoggingDb" writeLogStoredProcName="WriteLog"
          addCategoryStoredProcName="AddCategory" traceOutputOptions="DateTime, Timestamp, ProcessId, ThreadId, Callstack" />
    </listeners>
    <formatters>
      <add type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
          template="Timestamp: {timestamp}{newline}&#xA;Message: {message}{newline}&#xA;Category: {category}{newline}&#xA;Priority: {priority}{newline}&#xA;EventId: {eventid}{newline}&#xA;Severity: {severity}{newline}&#xA;Title:{title}{newline}&#xA;Machine: {localMachine}{newline}&#xA;App Domain: {localAppDomain}{newline}&#xA;ProcessId: {localProcessId}{newline}&#xA;Process Name: {localProcessName}{newline}&#xA;Thread Name: {threadName}{newline}&#xA;Win32 ThreadId:{win32ThreadId}{newline}&#xA;Extended Properties: {dictionary({key} - {value}{newline})}"
          name="Text Formatter" />
    </formatters>
    <categorySources>
      <add switchValue="All" name="MainLogger">
        <listeners>
          <add name="LoggingDb" />
        </listeners>
      </add>
    </categorySources>
    <specialSources>
      <allEvents switchValue="All" name="All Events">
        <listeners>
          <add name="LoggingDb" />
        </listeners>
      </allEvents>
      <notProcessed switchValue="All" name="Unprocessed Category">
        <listeners>
          <add name="LoggingDb" />
        </listeners>
      </notProcessed>
      <errors switchValue="All" name="Logging Errors &amp; Warnings">
        <listeners>
          <add name="LoggingDb" />
        </listeners>
      </errors>
    </specialSources>
  </loggingConfiguration>
  <dataConfiguration defaultDatabase="LoggingDb" />
  <connectionStrings>
    <add name="LoggingDb" connectionString="Server=tcp:********.database.windows.net,1433;Database=****.Logging;User ID=*******@*******;Password=**********;Trusted_Connection=False;Encrypt=True;" providerName="System.Data.SqlClient" />
  </connectionStrings>
</configuration>

И я получаю следующее исключение:

Недопустимый тип TraceListenerData в конфигурации 'listenerDataType = "Microsoft.Practices.EnterpriseLibrary.Logging.Database.Configuration.FormattedDatabaseTraceListenerData, Microsoft.Practices.Enterprise.Database, версия = 5.0.414.0, культура = нейтральная, PublicKeyToken = 31bf3856ad364e35 "'.(E: \ sitesroot \ 0 \ web.config строка 30)

Пока в Dev это работает ... Есть идеи или опыт по этому вопросу?

С уважением,

Джеймс

1 Ответ

1 голос
/ 21 марта 2012

Да, как прокомментировано, ниже приведены dll, которые должны быть в вашем сервисном каталоге, чтобы блок регистрации работал:

Microsoft.Practices.Unity.dll
Microsoft.Practices.ServiceLocation.dll
Microsoft.Practices.EnterpriseLibrary.Logging.Database.dll
Microsoft.Practices.EnterpriseLibrary.Logging.dll
Microsoft.Practices.EnterpriseLibrary.Common.dll
...