asp.net - 模拟时无法加载文件或程序集 'app_code' 或其依赖项之一

标签 asp.net iis-7 impersonation

我用VS2010制作了一个网站,并在IIS7上发布。它运行良好,但无法连接到 OLAP 服务器,因此我必须设置模拟。模拟在我的开发机器上的调试中运行良好,但是当我在服务器上发布它时,我收到此错误*:

Exception Details: System.IO.FileLoadException: Could not load file or assembly 'App_Code' or one of its dependencies. 
An API call exited abnormally. (Exception from HRESULT: 0x800300FA (STG_E_ABNORMALAPIEXIT))

当我评论 web.config 中的模拟行时,问题就消失了。

有人知道是什么原因造成的吗?

提前致谢, 纪尧姆

*这是实际消息的法语翻译:

Server Error in '/' Application.
Impossible de charger le fichier ou l'assembly 'App_Code' ou une de ses dépendances. Un appel API a été interrompu anormalement. (Exception de HRESULT : 0x800300FA (STG_E_ABNORMALAPIEXIT))
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.FileLoadException: Impossible de charger le fichier ou l'assembly 'App_Code' ou une de ses dépendances. Un appel API a été interrompu anormalement. (Exception de HRESULT : 0x800300FA (STG_E_ABNORMALAPIEXIT))

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Assembly Load Trace: The following information can be helpful to determine why the assembly 'App_Code' could not be loaded.

=== Informations d'état de liaison préalable ===
JRN : utilisateur = Unknown
JRN : DisplayName = App_Code
 (Partial)
AVT : des informations de liaison partielle ont été fournies pour un assembly :
AVT : Nom d'assembly : App_Code | ID de domaine : 2
AVT : une liaison partielle se produit lorsqu'une partie seulement du nom complet de l'assembly est fournie.
AVT : cela peut entraîner le chargement d'un assembly erroné par le classeur.
AVT : il est recommandé de fournir une identité textuelle complètement spécifiée pour l'assembly,
AVT : qui comprend le nom simple, la version, la culture et le jeton de clé publique.
AVT : pour plus d'informations et pour obtenir des solutions à ce problème, consultez le livre blanc à l'adresse suivante http://go.microsoft.com/fwlink/?LinkId=109270.
JRN : Appbase = file:///C:/inetpub/wwwroot/modstats/
JRN : PrivatePath initial = C:\inetpub\wwwroot\modstats\bin
Assembly appelant : (Unknown).
===
JRN : cette liaison démarre dans le contexte de chargement de default.
JRN : utilisation du fichier de configuration de l'application : C:\inetpub\wwwroot\modstats\web.config
JRN : utilisation du fichier de configuration d'hôte : C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet.config
JRN : utilisation du fichier de configuration de l'ordinateur à partir de C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
JRN : stratégie non appliquée à la référence à ce stade (liaison d'assembly privée, personnalisée, partielle ou basée sur l'emplacement).
JRN : tentative de téléchargement de la nouvelle URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/root/9e702efb/dfa5c6b2/App_Code.DLL.
JRN : tentative de téléchargement de la nouvelle URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/root/9e702efb/dfa5c6b2/App_Code/App_Code.DLL.
JRN : tentative de téléchargement de la nouvelle URL file:///C:/inetpub/wwwroot/modstats/bin/App_Code.DLL.
JRN : utilisation du fichier de configuration de l'application : C:\inetpub\wwwroot\modstats\web.config
JRN : utilisation du fichier de configuration d'hôte : C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet.config
JRN : utilisation du fichier de configuration de l'ordinateur à partir de C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
JRN : stratégie non appliquée à la référence à ce stade (liaison d'assembly privée, personnalisée, partielle ou basée sur l'emplacement).
ERR : impossible de terminer l'installation de l'assembly (hr = 0x800300fa). Détection terminée.


Stack Trace:

[FileLoadException: Impossible de charger le fichier ou l'assembly 'App_Code' ou une de ses dépendances. Un appel API a été interrompu anormalement. (Exception de HRESULT : 0x800300FA (STG_E_ABNORMALAPIEXIT))]

[FileLoadException: Impossible de charger le fichier ou l'assembly 'App_Code, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' ou une de ses dépendances. Un appel API a été interrompu anormalement. (Exception de HRESULT : 0x800300FA (STG_E_ABNORMALAPIEXIT))]
   System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
   System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks) +567
   System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +192
   System.Reflection.Assembly.Load(String assemblyString) +35
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +123

[ConfigurationErrorsException: Impossible de charger le fichier ou l'assembly 'App_Code, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' ou une de ses dépendances. Un appel API a été interrompu anormalement. (Exception de HRESULT : 0x800300FA (STG_E_ABNORMALAPIEXIT))]
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +11554224
   System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +485
   System.Web.Configuration.AssemblyInfo.get_AssemblyInternal() +79
   System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +337
   System.Web.Compilation.BuildManager.CallPreStartInitMethods() +280
   System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +1167

[HttpException (0x80004005): Impossible de charger le fichier ou l'assembly 'App_Code, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' ou une de ses dépendances. Un appel API a été interrompu anormalement. (Exception de HRESULT : 0x800300FA (STG_E_ABNORMALAPIEXIT))]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +11686928
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +141
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +4863749


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.237 

最佳答案

我的一位同事找到了解决方案 - 我现在欠他一杯啤酒!

在IIS7控制面板中,进入网站的基本参数。指定模拟的用户。

重新加载网站时,它现在会提示无法访问“...\Temporary ASP.NET Files”,为模拟用户提供读/写访问权限。

瞧!

关于asp.net - 模拟时无法加载文件或程序集 'app_code' 或其依赖项之一,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7585126/

相关文章:

c# - 授予ASPNETDB.MDF SQL DB IIS_IUSRS权限

asp.net-mvc - URL 中的点会导致 ASP.NET mvc 和 IIS 出现 404

.net - 使用 ServiceController 和模拟启动远程 Windows 服务

asp.net - 我可以使用 Mono 和 mod_mono 托管 ASP.NET MVC 网站吗?

javascript - ASP gridview的Reload事件

ASP.NET Ajax 未与 IIS 7 一起运行

asp.net - System.DirectoryServices.AccountManagement.UserPrincipal - localhost 但不是 iis

c# - 使用 LOGON32_LOGON_NEW_CREDENTIALS 模拟 Windows 有什么魔力?

asp.net - 运行测试时出错: "You must add a reference to assembly..."

包含文件之间的 Javascript 事件委托(delegate)