Why does my ASP.NET 4.0 web service fail with a compliation error with NetworkService but succeed with LocalSystem
While the error message indicates the problem is specific to directory rights in the following directory:
c:\Windows\Microsoft.NET\
Framework\v4.0.30319\Temporary ASP.NET Files\kswsextensionservicesweb\f2efe503\
31c03187\App_global.asax.4gcxry4d.dll'
check that you have appropriate/full rights granted to the Network Service group on C:\WINDOWS\TEMP and/or C:\WINDOWS\TMP directories.
praveen
Updated on June 04, 2022Comments
-
praveen almost 2 years
I started getting server-side compliation errors indicating that the identity of my web service's application pool could not access files within a temporary ASP.NET folder. If I change the identity of the application pool from NetworkService to LocalSystem, the problem goes away. I can't see any issue with the security settings on the folder and I reran aspnet_regiis -i to no effect.
The complete exception as it appears in the application error log is included below, but the gist of it is:
HttpCompileException error CS0016: Could not write to output file 'c:\Windows\Microsoft.NET\ Framework\v4.0.30319\Temporary ASP.NET Files\kswsextensionservicesweb\f2efe503\ 31c03187\App_global.asax.4gcxry4d.dll' -- 'Access is denied. '
Can anyone explain why? What's strange is that it had been working. Something changed, but I can't figure out what.
Log Name: Application Source: ASP.NET 4.0.30319.0 Date: 3/12/2011 12:41:21 PM Event ID: 1310 Task Category: Web Event Level: Warning Keywords: Classic User: N/A Computer: NYDMTRAIN01.kayescholer.com Description: Event code: 3007 Event message: A compilation error has occurred. Event time: 3/12/2011 12:41:21 PM Event time (UTC): 3/12/2011 5:41:21 PM Event ID: bc285ecdc00941d28070725f55ea24f1 Event sequence: 3 Event occurrence: 1 Event detail code: 0 Application information: Application domain: /LM/W3SVC/1/ROOT/KSWSExtensionServicesWeb-2-129444252812003152 Trust level: Full Application Virtual Path: /KSWSExtensionServicesWeb Application Path: C:\inetpub\wwwroot\KSWSExtensionServicesWeb\ Machine name: NYDMTRAIN01 Process information: Process ID: 3988 Process name: w3wp.exe Account name: NT AUTHORITY\NETWORK SERVICE Exception information: Exception type: HttpCompileException Exception message: (0): error CS0016: Could not write to output file 'c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\kswsextensionservicesweb\f2efe503\31c03187\App_global.asax.4gcxry4d.dll' -- 'Access is denied. ' at System.Web.Compilation.AssemblyBuilder.Compile() at System.Web.Compilation.BuildProvidersCompiler.PerformBuild() at System.Web.Compilation.ApplicationBuildProvider.GetGlobalAsaxBuildResult(Boolean isPrecompiledApp) at System.Web.Compilation.BuildManager.CompileGlobalAsax() at System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() at System.Web.Compilation.BuildManager.CallAppInitializeMethod() at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) Request information: Request URL: http://nydmtrain01/KSWSExtensionServicesWeb/Services/KSWSDocumentHistoryService.svc Request path: /KSWSExtensionServicesWeb/Services/KSWSDocumentHistoryService.svc User host address: 172.25.43.171 User: Is authenticated: False Authentication Type: Thread account name: NT AUTHORITY\NETWORK SERVICE Thread information: Thread ID: 6 Thread account name: NT AUTHORITY\NETWORK SERVICE Is impersonating: False Stack trace: at System.Web.Compilation.AssemblyBuilder.Compile() at System.Web.Compilation.BuildProvidersCompiler.PerformBuild() at System.Web.Compilation.ApplicationBuildProvider.GetGlobalAsaxBuildResult(Boolean isPrecompiledApp) at System.Web.Compilation.BuildManager.CompileGlobalAsax() at System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() at System.Web.Compilation.BuildManager.CallAppInitializeMethod() at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) Custom event details: Event Xml: <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event"> <System> <Provider Name="ASP.NET 4.0.30319.0" /> <EventID Qualifiers="32768">1310</EventID> <Level>3</Level> <Task>3</Task> <Keywords>0x80000000000000</Keywords> <TimeCreated SystemTime="2011-03-12T17:41:21.000Z" /> <EventRecordID>127544</EventRecordID> <Channel>Application</Channel> <Computer>NYDMTRAIN01.kayescholer.com</Computer> <Security /> </System> <EventData> <Data>3007</Data> <Data>A compilation error has occurred.</Data> <Data>3/12/2011 12:41:21 PM</Data> <Data>3/12/2011 5:41:21 PM</Data> <Data>bc285ecdc00941d28070725f55ea24f1</Data> <Data>3</Data> <Data>1</Data> <Data>0</Data> <Data>/LM/W3SVC/1/ROOT/KSWSExtensionServicesWeb-2-129444252812003152</Data> <Data>Full</Data> <Data>/KSWSExtensionServicesWeb</Data> <Data>C:\inetpub\wwwroot\KSWSExtensionServicesWeb\</Data> <Data>NYDMTRAIN01</Data> <Data> </Data> <Data>3988</Data> <Data>w3wp.exe</Data> <Data>NT AUTHORITY\NETWORK SERVICE</Data> <Data>HttpCompileException</Data> <Data>(0): error CS0016: Could not write to output file 'c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\kswsextensionservicesweb\f2efe503\31c03187\App_global.asax.4gcxry4d.dll' -- 'Access is denied. ' at System.Web.Compilation.AssemblyBuilder.Compile() at System.Web.Compilation.BuildProvidersCompiler.PerformBuild() at System.Web.Compilation.ApplicationBuildProvider.GetGlobalAsaxBuildResult(Boolean isPrecompiledApp) at System.Web.Compilation.BuildManager.CompileGlobalAsax() at System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() at System.Web.Compilation.BuildManager.CallAppInitializeMethod() at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) </Data> <Data>http://nydmtrain01/KSWSExtensionServicesWeb/Services/KSWSDocumentHistoryService.svc</Data> <Data>/KSWSExtensionServicesWeb/Services/KSWSDocumentHistoryService.svc</Data> <Data>172.25.43.171</Data> <Data> </Data> <Data>False</Data> <Data> </Data> <Data>NT AUTHORITY\NETWORK SERVICE</Data> <Data>6</Data> <Data>NT AUTHORITY\NETWORK SERVICE</Data> <Data>False</Data> <Data> at System.Web.Compilation.AssemblyBuilder.Compile() at System.Web.Compilation.BuildProvidersCompiler.PerformBuild() at System.Web.Compilation.ApplicationBuildProvider.GetGlobalAsaxBuildResult(Boolean isPrecompiledApp) at System.Web.Compilation.BuildManager.CompileGlobalAsax() at System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() at System.Web.Compilation.BuildManager.CallAppInitializeMethod() at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) </Data> </EventData> </Event>
-
James over 11 yearsIf this doesn't work check the name or location of your temporary folders haven't been changed in your Environment variables.