Error after deploy driving me crazy

Vote:
 

For a site we have we sometimes (not always) get an error like this after done a deploy with web deploy:

Exception information:
Exception type: HttpException
Exception message: The assembly 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\a51db5b5\7a1abf6e\App_Code.dll' is already loaded in another appdomain. Setting in machine.config can help solve this issue.
at System.Web.Compilation.BuildManager.ReportTopLevelCompilationException()
at System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled()
at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException)

The assembly 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\a51db5b5\7a1abf6e\App_Code.dll' is already loaded in another appdomain. Setting in machine.config can help solve this issue.
at System.Web.Compilation.CodeDirectoryCompiler.GetCodeDirectoryAssembly(VirtualPath virtualDir, CodeDirectoryType dirType, String assemblyName, StringSet excludedSubdirectories, Boolean isDirectoryAllowed)
at System.Web.Compilation.BuildManager.CompileCodeDirectory(VirtualPath virtualDir, CodeDirectoryType dirType, String assemblyName, StringSet excludedSubdirectories)
at System.Web.Compilation.BuildManager.CompileCodeDirectories()
at System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled()

We do not have deployment retail = true as the messages suggest, but we do have the release-mode on it.

Do you others set

#118290
Mar 03, 2015 21:40
Vote:
 

Strange. Do you have any code in App_Code folder?

It should be compiled to App_Code.r4nd0mch4r.dll, instead of App_Code.dll ...

/Q

#118301
Mar 04, 2015 8:08
Vote:
 

Yes it is strange. We do not have any code in that folder, we accually do not have any such folder at all...

#118331
Mar 04, 2015 15:05
Vote:
 

Hi,

Did you try to delete the dll? Did it work?

/Q

#118333
Mar 04, 2015 15:13
Vote:
 

What are settings for your IIS app pool? Start automatically. We came across the same issue time to time. Does not happend after every deploy. Switched to not-auto-start app pool - seems that this may solve the issue. It's not a solution, just a workaround.

#118339
Mar 04, 2015 15:45
Vote:
 

I do a IIS reset and that solves the problem but is not fun to do :(

#118340
Mar 04, 2015 15:45
Vote:
 

Just ran into this exact same error, and resetting IIS worked for me. Was this a recurring issue for you, or just once?

#174019
Jan 16, 2017 18:19
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.