Vb.net web服务迁移企业库版本2到5的问题

Vb.net web服务迁移企业库版本2到5的问题,vb.net,web-services,enterprise-library,Vb.net,Web Services,Enterprise Library,我已将我的web服务项目从VS2005升级到2012。My webservice使用项目在事件查看器中记录状态,inturn使用企业库2.0。现在我已经升级了,我将所有配置和DLL都更改为更新的版本,但在调试时出现以下异常 {“尝试获取LogWriter类型的实例,键为“””时发生激活错误”} 内部异常: {“依赖项解析失败,类型=“Microsoft.Practices.EnterpriseLibrary.Logging.LogWriter”,name=“(无)”。 解析时发生异常。 异常为:

我已将我的web服务项目从VS2005升级到2012。My webservice使用项目在事件查看器中记录状态,inturn使用企业库2.0。现在我已经升级了,我将所有配置和DLL都更改为更新的版本,但在调试时出现以下异常

{“尝试获取LogWriter类型的实例,键为“””时发生激活错误”}

内部异常:

{“依赖项解析失败,类型=“Microsoft.Practices.EnterpriseLibrary.Logging.LogWriter”,name=“(无)”。 解析时发生异常。 异常为:InvalidOperationException-无法构造类型LogWriter。必须配置容器以提供此值

发生异常时,容器为:

解析Microsoft.Practices.EnterpriseLibrary.Logging.LogWriter(无) “}

堆栈跟踪:

在Microsoft.Practices.Unity.UnityContainer.DoBuildUp(类型t,对象存在,字符串名,IEnumerable1 ResolveRRides) 在Microsoft.Practices.Unity.UnityContainer.DoBuildUp上(键入t,字符串名,IEnumerable1 Resolverrides) 在Microsoft.Practices.Unity.UnityContainer.Resolve(键入t,字符串名称,ResolverOverride[]resolverOverrides) 在Microsoft.Practices.Unity.UnityServiceLocator.DoGetInstance(输入serviceType,字符串键) 位于Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance(类型serviceType,字符串键)

你能帮我解决这个问题吗,因为我已经在这个问题上工作了三天了,运气不好

app.config:

<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"/>
<section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
  <section name="EnService.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" requirePermission="false" />
</sectionGroup>
</configSections> 
<loggingConfiguration name="Logging Application Block" tracingEnabled="true"
defaultCategory="General" logWarningsWhenNoCategoriesMatch="true">
<listeners>
  <add source="EnService" formatter="Text Formatter" log="MPASLog"
    machineName="" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FormattedEventLogTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    traceOutputOptions="None" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FormattedEventLogTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"    />           
</listeners>
<formatters>
  <add template="Timestamp: {timestamp}&#xD;&#xA;Message: {message}&#xD;&#xA;Category: {category}&#xD;&#xA;Priority: {priority}&#xD;&#xA;EventId: {eventid}&#xD;&#xA;Severity: {severity}&#xD;&#xA;Title:{title}&#xD;&#xA;Machine: {machine}&#xD;&#xA;Application Domain: {appDomain}&#xD;&#xA;Process Id: {processId}&#xD;&#xA;Process Name: {processName}&#xD;&#xA;Win32 Thread Id: {win32ThreadId}&#xD;&#xA;Thread Name: {threadName}&#xD;&#xA;Extended Properties: {dictionary({key} - {value}&#xD;&#xA;)}"
    type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    name="Text Formatter" />
</formatters>
<categorySources>
  <add switchValue="All" name="General">
    <listeners>
      <add name="Formatted EventLog TraceListener" />
    </listeners>
  </add>
</categorySources>
<specialSources>
  <allEvents switchValue="All" name="All Events" />
  <notProcessed switchValue="All" name="Unprocessed Category" />
  <errors switchValue="All" name="Logging Errors &amp; Warnings">
    <listeners>
      <add name="Formatted EventLog TraceListener" />
    </listeners>
  </errors>
</specialSources>
</loggingConfiguration> 
<system.diagnostics>
<sources>
  <!-- This section defines the logging configuration for My.Application.Log -->
  <source name="DefaultSource" switchName="DefaultSwitch">
    <listeners>
      <add name="FileLog" />
      <!-- Uncomment the below section to write to the Application Event Log -->
      <!--<add name="EventLog"/>-->
    </listeners>
  </source>
</sources>
<switches>
  <add name="DefaultSwitch" value="Information" />
</switches>
<sharedListeners>
  <add name="FileLog" type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" initializeData="FileLogWriter" />
  <!-- Uncomment the below section and replace APPLICATION_NAME with the name of your application to write to the Application Event Log -->
  <!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> -->
</sharedListeners>
</system.diagnostics> 
<applicationSettings>
<EnService.My.MySettings>
  <setting name="CONST_PRINT_LOG" serializeAs="String">
    <value>1</value>
  </setting>
  <setting name="CONST_JOB_STATUS_SUCCESS" serializeAs="String">
    <value>1</value>
  </setting>
  <setting name="CONST_WEB_SERVICE_TIME_OUT" serializeAs="String">
    <value>10800000</value>
  </setting>
  <setting name="Seperater" serializeAs="String">
    <value>.</value>
  </setting>
  <setting name="EnService_EnServiceWebReference_EnServiceService" serializeAs="String">
    <value>http://localhost/EnServiceService.asmx</value>
  </setting>
  <setting name="PrintFolder" serializeAs="String">
    <value>C:\Jobs\PrintDocuments\</value>
  </setting>
  <setting name="ResultLocation" serializeAs="String">
    <value>C:\Jobs\EnService\Result</value>
  </setting>
  <setting name="ArchiveFilePrefix" serializeAs="String">
    <value>EnService_Report_</value>
  </setting>
  <setting name="ExceptionArchiveFilePrefix" serializeAs="String">
    <value>EnService_Exception_Report_</value>
  </setting>
  <setting name="CONST_PRINT_REPORT" serializeAs="String">
    <value>X</value>
  </setting>
  <setting name="ReportArchiveLocation" serializeAs="String">
    <value>C:\Jobs\EnService\OUT</value>
  </setting>
  <setting name="CommonWebServiceURL" serializeAs="String">
    <value>http://localhost/WebService/Service.asmx</value>
  </setting>
</EnService.My.MySettings>
</applicationSettings> 
<startup> 
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/> 
</startup> 
</configuration>

1.
1.
10800000
.
http://localhost/EnServiceService.asmx
C:\Jobs\PrintDocuments\
C:\Jobs\nservice\Result
电子服务报告_
服务异常报告_
X
C:\Jobs\n服务\OUT
http://localhost/WebService/Service.asmx
谢谢你的帮助

Vinay

我在应用程序中使用了logger.write()

当我加上

Logger.SetLogWriter(新LogWriterFactory().Create(),False)`

我的应用程序运行良好。

我在应用程序中使用了logger.write(),新的ent库要求我们添加一个容器。当我添加“Logger.SetLogWriter(新LogWriterFactory().Create(),False)”时,我的应用程序运行良好。