Overwriting .DLLs is causing a ServiceActivationException

Following a deploy of newer .DLLs to the Bin folder of a website which hosted some services, the services began to display a ServiceActivationException exception.

WebHost failed to process a request.
 Sender Information: System.ServiceModel.Activation.HostedHttpRequestAsyncResult/17003858
 Exception: System.ServiceModel.ServiceActivationException: The service '{ServiceName}' cannot be activated due to an exception during compilation.  The exception message is: Could not load file or assembly '{AssemblyName}, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.. ---> System.IO.FileNotFoundException: Could not load file or assembly '{AssemblyName}, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
   at System.Reflection.Assembly.Load(String assemblyString)
   at System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses)
   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 ---
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

The website is hosted on a Windows 2008 Server machine running Internet Information Services 7.

This issue was resolved by taking the following steps:

  1. Stop Internet Information Services
  2. Delete all the temporary files at the following location(s):
    %windir%\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files
    %windir%\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files (on 64bit machines only)
  3. Start Internet Information Services

After following the above steps the web services started to work again.

@MobeenAnwar

Author: Mobeen Anwar

Share This Post On

1 Comment

  1. what is root cause of this problem ?

    Post a Reply

Submit a Comment

Your email address will not be published. Required fields are marked *