开发者

Could not load file or assembly 'app_code' or one of its dependencies when impersonating

开发者 https://www.devze.com 2023-04-08 20:24 出处:网络
I made a web site with VS2010 and publish it on IIS7. It runs fine but it can\'t connect to an OLAP server so I had to setup impersonation. Impersonation runs fine in debug on my dev machine, but when

I made a web site with VS2010 and publish it on IIS7. It runs fine but it can't connect to an OLAP server so I had to setup impersonation. Impersonation runs fine in debug on my dev machine, but when I publish this on the server, I get this error*:

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))

When I comment the impersonate line in web.config the problem disappears.

Anyone has an idea about what could be causing this?

Thanks in advance, Guillaume

*This is a translation of the actual message in french:

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. (Exce开发者_运维知识库ption 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 


One of my colleagues found the solution -- I now owe him a beer!

In the IIS7 control panel, to go the Basic Parameters for the web site. Specify the impersonated user.

When reloading the site, it will now complain that it can't access "...\Temporary ASP.NET Files" give read/write access to the impersonated user.

Voilà!


I got the same error message.

In my case, the "Application Pool" on IIS was using a wrong .NET Framework version. So I just changed to ".NET Framework v4.0.30319".


Give write permission (add everyone) to Temporary ASP.NET Files

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号