安装或更新服务后服务激活错误

Posted

技术标签:

【中文标题】安装或更新服务后服务激活错误【英文标题】:Service Activation error after install or update service 【发布时间】:2015-03-14 00:51:22 【问题描述】:

我在 wcf 服务启动时收到此异常:

应用程序日志文件未写入 bin 文件夹中。

我在云开发环境中没有收到此异常,而是在生产环境中收到此错误。

两个环境都安装了相同的 KB

Wcf 跟踪

 <E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent">
<System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system">
<EventID>131074</EventID>
<Type>3</Type>
<SubType Name="Error">0</SubType>
<Level>2</Level>
<TimeCreated SystemTime="2014-12-09T16:19:45.1760880Z" />
<Source Name="System.ServiceModel" />
<Correlation ActivityID="00000000-0000-0000-0000-000000000000" />
<Execution ProcessName="w3wp" ProcessID="13464" ThreadID="6" />
<Channel />
<Computer>02SRV0054H</Computer>
</System>
<ApplicationData>
<TraceData>
<DataItem>
<TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Error">
<TraceIdentifier>http://msdn.microsoft.com/it-IT/library/System.ServiceModel.Diagnostics.EventLog.aspx</TraceIdentifier>
<Description>Wrote to the EventLog.</Description>
<AppDomain>/LM/W3SVC/1/ROOT-1-130626155754104254</AppDomain>
<ExtendedData xmlns="http://schemas.microsoft.com/2006/08/ServiceModel/DictionaryTraceRecord">
<CategoryID.Name>WebHost</CategoryID.Name>
<CategoryID.Value>5</CategoryID.Value>
<InstanceID.Name>WebHostFailedToProcessRequest</InstanceID.Name>
<InstanceID.Value>3221356547</InstanceID.Value>
<Value0>System.ServiceModel.Activation.HostedHttpRequestAsyncResult/19202350</Value0>
<Value1>System.ServiceModel.ServiceActivationException: The service '/MessageExchangeService.svc' cannot be activated due to an exception during compilation.  The exception message is: Object reference not set to an instance of an object.. ---&gt; System.NullReferenceException: Object reference not set to an instance of an object.
   at System.Web.Compilation.DiskBuildResultCache.CacheBuildResult(String cacheKey, BuildResult result, Int64 hashCode, DateTime utcStart)
   at System.Web.Compilation.BuildManager.CacheBuildResultInternal(String cacheKey, BuildResult result, Int64 hashCode, DateTime utcStart)
   at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath)
   at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
   at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
   at System.Web.Compilation.BuildManager.GetVPathBuildResult(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean ensureIsUpToDate)
   at System.Web.Compilation.BuildManager.GetCompiledCustomString(String virtualPath)
   at System.ServiceModel.ServiceHostingEnvironment.HostingManager.GetCompiledCustomString(String normalizedVirtualPath)
   at System.ServiceModel.ServiceHostingEnvironment.HostingManager.CreateService(String normalizedVirtualPath)
   at System.ServiceModel.ServiceHostingEnvironment.HostingManager.ActivateService(String normalizedVirtualPath)
   at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath)
   --- End of inner exception stack trace ---
   at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
   at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result)</Value1>
</ExtendedData>
</TraceRecord>
</DataItem>
</TraceData>
</ApplicationData>
</E2ETraceEvent>



<E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent">
<System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system">
<EventID>131074</EventID>
<Type>3</Type>
<SubType Name="Error">0</SubType>
<Level>2</Level>
<TimeCreated SystemTime="2014-12-09T16:19:45.1760880Z" />
<Source Name="System.ServiceModel" />
<Correlation ActivityID="00000000-0000-0000-0000-000000000000" />
<Execution ProcessName="w3wp" ProcessID="13464" ThreadID="6" />
<Channel />
<Computer>02SRV0054H</Computer>
</System>
<ApplicationData>
<TraceData>
<DataItem>
<TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Error">
<TraceIdentifier>http://msdn.microsoft.com/it-IT/library/System.ServiceModel.Diagnostics.EventLog.aspx</TraceIdentifier>
<Description>Wrote to the EventLog.</Description>
<AppDomain>/LM/W3SVC/1/ROOT-1-130626155754104254</AppDomain>
<ExtendedData xmlns="http://schemas.microsoft.com/2006/08/ServiceModel/DictionaryTraceRecord">
<CategoryID.Name>WebHost</CategoryID.Name>
<CategoryID.Value>5</CategoryID.Value>
<InstanceID.Name>WebHostFailedToProcessRequest</InstanceID.Name>
<InstanceID.Value>3221356547</InstanceID.Value>
<Value0>System.ServiceModel.ServiceHostingEnvironment+HostingManager/35320229</Value0>
<Value1>System.ServiceModel.ServiceActivationException: The service '/MessageExchangeService.svc' cannot be activated due to an exception during compilation.  The exception message is: Object reference not set to an instance of an object.. ---&gt; System.NullReferenceException: Object reference not set to an instance of an object.
   at System.Web.Compilation.DiskBuildResultCache.CacheBuildResult(String cacheKey, BuildResult result, Int64 hashCode, DateTime utcStart)
   at System.Web.Compilation.BuildManager.CacheBuildResultInternal(String cacheKey, BuildResult result, Int64 hashCode, DateTime utcStart)
   at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath)
   at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
   at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
   at System.Web.Compilation.BuildManager.GetVPathBuildResult(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean ensureIsUpToDate)
   at System.Web.Compilation.BuildManager.GetCompiledCustomString(String virtualPath)
   at System.ServiceModel.ServiceHostingEnvironment.HostingManager.GetCompiledCustomString(String normalizedVirtualPath)
   at System.ServiceModel.ServiceHostingEnvironment.HostingManager.CreateService(String normalizedVirtualPath)
   at System.ServiceModel.ServiceHostingEnvironment.HostingManager.ActivateService(String normalizedVirtualPath)
   at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath)
   --- End of inner exception stack trace ---
   at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath)
   at System.ServiceModel.ServiceHostingEnvironment.EnsureServiceAvailableFast(String relativeVirtualPath)</Value1>
</ExtendedData>
</TraceRecord>
</DataItem>
</TraceData>
</ApplicationData>

为什么会出现这个异常?

【问题讨论】:

在Problems with NotFound errors and compilation failures查看类似问题 【参考方案1】:

尝试回收您的应用程序池。这可能会解决问题。还要查看您的应用程序池的 IIS 日志。

看到这个link。

【讨论】:

以上是关于安装或更新服务后服务激活错误的主要内容,如果未能解决你的问题,请参考以下文章

Windows进程激活服务错误2:系统找不到指定的文件

错误0x80070422:无法启动服务器,原因肯能是已被禁用或与其相关联的设备没有启动

安装 WindowsXP 更新后出现 WCF 服务错误

安装好AD域服务器后做组策略的强制更新出现错误

win10.10 激活

windows 10 服务组件安装出现0x80070422错误解决方法