error ASPRUNTIME: The application domain in which the thread was running has been unloaded.

Hi,

I'm trying to run the Publish profile from a Visual Studio 2013 ASP.NET Website but i'm getting errors when trying to do so.

I'm getting the above error when trying to run a Publish step in the build agent of my build configuration (the publish step runs aspnet_compiler.exe) to run the Publish profile from the Visual Studio project.

The actual command i'm running is:
 

C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler.exe -v /ProjectV3 -p C:\Users\TeamCityInt-SVC\AppData\Local\Temp\WebSitePublish\ProjectV3-126155122\obj\Debug\AspnetCompileMerge\Source C:\Users\TeamCityInt-SVC\AppData\Local\Temp\WebSitePublish\ProjectV3-126155122\obj\Debug\AspnetCompileMerge\TempBuildDir -errorstack
 
This gives the following output and this error occurs:

[11:06:46][Step 4/4] Starting: D:\TeamCity\buildAgent\temp\agentTmp\custom_script946487530395293749.cmd
[11:06:46][Step 4/4] in directory: D:\TeamCity\buildAgent\work\a162dbdc7fa1fe69
[11:06:46][Step 4/4] Microsoft (R) ASP.NET Compilation Tool version 4.0.30319.33440
[11:06:46][Step 4/4] Utility to precompile an ASP.NET application
[11:06:46][Step 4/4] Copyright (C) Microsoft Corporation. All rights reserved.
[11:06:46][Step 4/4]
[11:06:48][Step 4/4] error ASPRUNTIME: The application domain in which the thread was running has been unloaded.
[11:06:48][Step 4/4]
[11:06:48][Step 4/4] [AppDomainUnloadedException]: The application domain in which the thread was running has been unloaded.
[11:06:48][Step 4/4]    at System.Web.Compilation.BuildManagerHost.PrecompileApp(ClientBuildManagerCallback callback, List`1 excludedVirtualPaths)
[11:06:48][Step 4/4]    at System.Web.Compilation.ClientBuildManager.PrecompileApplication(ClientBuildManagerCallback callback, Boolean forceCleanBuild)
[11:06:48][Step 4/4]    at System.Web.Compilation.ClientBuildManager.PrecompileApplication(ClientBuildManagerCallback callback)
[11:06:48][Step 4/4]    at System.Web.Compilation.Precompiler.Main(String[] args)
 
(I've turned on the error stack reporting to give some more info above).

What I can't understand is that running the aspnet_compiler.exe command from above on the server in an (Administrator) Command Prompt runs perfectly with no errors.

From looking at the web it seems the suggestion is that this error can occur when memory is low on the server but currently we are running at 1.9GB out of 4GB usage (there are no giant peaks whilst aspnet_compiler.exe is building).

Any help or information would be greatly appreciated.

Regards,

Alex.

1 comment
Comment actions Permalink

Hi Alex,

Did you run the build on TeamCity agent machine under the same user that the agent is running? Please follow all the steps described in this section in documentation. What are the results?

0

Please sign in to leave a comment.