visual-studio 由于“尝试访问未加载的 AppDomain”,无法在 VS 中编译解决方案——如何将其固定?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4085100/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-22 12:40:49  来源:igfitidea点击:

Cannot compile solution in VS due "Attempted to access an unloaded AppDomain" -- how to pin it down?

visual-studio

提问by greenoldman

I have a C#/ASP.Net solution in VS (2008) with several projects within it. When I try to compile it I get one error only:

我在 VS(2008)中有一个 C#/ASP.Net 解决方案,其中包含多个项目。当我尝试编译它时,我只收到一个错误:

Attempted to access an unloaded AppDomain

试图访问卸载的 AppDomain

No line code, no project name, nothing. Just such error.

没有行代码,没有项目名称,什么都没有。就是这样的错误。

How can I pin down this error -- i.e. the cause, or even better -- how can I solve it and continue compilation?

我怎样才能确定这个错误——即原因,甚至更好——我怎样才能解决它并继续编译?

Thank you in advance.

先感谢您。

回答by Amit Joki

Shut down Visual Studio and reopen it. Then clean the Temp folder.

关闭 Visual Studio 并重新打开它。然后清理 Temp 文件夹。

For that press Windows+Rand type %Temp%and click Ok, then delete everything.

为此,请按Windows+R并键入%Temp%并单击“确定”,然后删除所有内容。

回答by Mer Hardik

If this error comes with VS follow these steps

如果此错误随 VS 一起出现,请按照以下步骤操作

  1. Just restart your VS.
  2. Start VS again
  3. Clean the solution (Build> Clean Solution)
  4. Rebuild your project again
  1. 只需重新启动您的 VS。
  2. 再次启动VS
  3. 清洁解决方案(构建> 清洁解决方案)
  4. 再次重建你的项目

If this error comes with IIS

如果此错误随 IIS 一起出现

  • Restart (recycle) the IIS Application Pools in IIS Manager, After restarting check run the solution again!
  • 在 IIS 管理器中重新启动(回收)IIS 应用程序池,重新启动检查后再次运行解决方案!

回答by Mer Hardik

There are many possibilities:

有很多可能性:

  1. Try resetting your Visual Studio's Setting.

  2. Or check all dlls which are referenced.

  3. Check all the namespaces which are being used in your application, Do they exist?
  1. 尝试重置 Visual Studio 的设置。

  2. 或者检查所有引用的dll。

  3. 检查应用程序中使用的所有命名空间,它们是否存在?

回答by gimlichael

I am experiencing the same in Visual Studio 2012 - but ONLY on websites hosted on UNC share. My solution (when it occur) is to unload the web project and reload it again. Then in works for some time again.

我在 Visual Studio 2012 中遇到了同样的情况 - 但仅在托管在 UNC 共享上的网站上。我的解决方案(当它发生时)是卸载 web 项目并重新加载它。然后又工作了一段时间。

The problem as I recall it is, that the hosted UNC share (or the workstation trying to access it) is running an x86 version of Windows, which does not allow to many open network connections.

我记得的问题是,托管的 UNC 共享(或尝试访问它的工作站)正在运行 x86 版本的 Windows,它不允许许多开放的网络连接。

In my experience these sort of problems disappear on true x64 environments.

根据我的经验,这些问题在真正的 x64 环境中会消失。

Cheers.

干杯。

回答by mrTurkay

it means, there is something in WebConfig/AppConfig not compatible and cannot load.

这意味着,WebConfig/AppConfig 中存在不兼容且无法加载的内容。

For ex. ?f you published project, check app_data/publish profiles, delete them.

例如。?如果你发布了项目,检查 app_data/publish 配置文件,删除它们。

回答by Kishan

  1. Check your .sln file first if it is conflicted then delete it and update your svn folder and rebuild your solution.

  2. Rebuild your solution

  1. 如果您的 .sln 文件有冲突,请先检查它,然后将其删除并更新您的 svn 文件夹并重建您的解决方案。

  2. 重建您的解决方案

回答by Prasanth Louis

It's also possible that your unit test started up a thread but didn't close it. Ensure your threads are all closed before completion. It might be a good idea to verify all your unit tests are running and passing correctly.

也有可能您的单元测试启动了一个线程但没有关闭它。确保您的线程在完成之前全部关闭。验证所有单元测试是否正确运行和通过可能是一个好主意。

回答by Tamilselvan K

Exit the local webserver(IIS express) from the system tray and delete asp.net temp files from temporary folder & then try clean,rebuild and run your application

从系统托盘退出本地网络服务器(IIS express)并从临时文件夹中删除 asp.net 临时文件,然后尝试清理、重建并运行您的应用程序

回答by Samim Hussain

Following are the steps i followed to get rid of such error-

以下是我为摆脱此类错误而遵循的步骤-

  • Press Windows+R , write %Temp% and hit enter. Now,delete all the temporary files from the directory.
  • Restart your visual studio.
  • Clean your project solution from Solution explorer in Visual studio List item.
  • Rebuild the project & Run . It should work expected.
  • 按 Windows+R ,输入 %Temp% 并按回车键。现在,从目录中删除所有临时文件。
  • 重新启动您的视觉工作室。
  • 从 Visual Studio 列表项中的解决方案资源管理器中清理您的项目解决方案。
  • 重建项目并运行。它应该可以正常工作。