Asked by:
Exceptions when debugging with IIS Express in User Mode

Question
-
User1331021659 posted
This problem is related to Visual Studio debugging with IIS Express
My understanding is that IIS Express is designed to allow users to debug without elevating your permissions, however whenever I try to use IIS Express to do this, and have exception handling enabled, I get several security exceptions. These exceptions do not prevent the web server from running if I do not enable exception debugging, but they are highly annoying when I want to debug.
Is there anything I can do about them?
The first is an Access Check in C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files
The file has the name ~AspAccessCheck_randomstring
I can work around this by giving normal users full rights to this folder, however after that I get a Registry Security Exception. The call stack looks like this:
> mscorlib.dll!System.ThrowHelper.ThrowSecurityException(System.ExceptionResource resource) + 0x35 bytes mscorlib.dll!Microsoft.Win32.RegistryKey.OpenSubKey(string name, bool writable) + 0x131 bytes mscorlib.dll!Microsoft.Win32.RegistryKey.OpenSubKey(string name) + 0x7 bytes System.Web.dll!System.Web.Util.Misc.OpenAspNetRegKey(string subKey) + 0xa9 bytes System.Web.dll!System.Web.Util.Misc.GetAspNetRegValue(string subKey, string valueName = null, object defaultValue = null) + 0x25 bytes System.Web.dll!System.Web.Compilation.CompilationMutex.CompilationMutex(string name = "CLa09782a8", string comment = "CompilationLock for /") + 0x1e bytes System.Web.dll!System.Web.Compilation.CompilationLock.CompilationLock() + 0xff bytes [Native to Managed Transition] [Managed to Native Transition] System.Web.dll!System.Web.Compilation.CompilationLock.GetLock(ref bool gotLock = false) + 0x21 bytes System.Web.dll!System.Web.Compilation.BuildManager.CheckTopLevelFilesUpToDate(System.Web.Compilation.StandardDiskBuildResultCache diskCache = {System.Web.Compilation.StandardDiskBuildResultCache}) + 0x2f bytes System.Web.dll!System.Web.Compilation.BuildManager.RegularAppRuntimeModeInitialize() + 0xaf bytes System.Web.dll!System.Web.Compilation.BuildManager.Initialize() + 0x106 bytes System.Web.dll!System.Web.Compilation.BuildManager.InitializeBuildManager() + 0xb8 bytes System.Web.dll!System.Web.HttpRuntime.HostingInit(System.Web.Hosting.HostingEnvironmentFlags hostingFlags = Default, System.Security.Policy.PolicyLevel policyLevel, System.Exception appDomainCreationException) + 0x213 bytes System.Web.dll!System.Web.HttpRuntime.InitializeHostingFeatures(System.Web.Hosting.HostingEnvironmentFlags hostingFlags, System.Security.Policy.PolicyLevel policyLevel, System.Exception appDomainCreationException) + 0x3c bytes System.Web.dll!System.Web.Hosting.HostingEnvironment.Initialize(System.Web.Hosting.ApplicationManager appManager, System.Web.Hosting.IApplicationHost appHost, System.Web.Configuration.IConfigMapPathFactory configMapPathFactory, System.Web.Hosting.HostingEnvironmentParameters hostingParameters, System.Security.Policy.PolicyLevel policyLevel, System.Exception appDomainCreationException) + 0x27a bytes System.Web.dll!System.Web.Hosting.HostingEnvironment.Initialize(System.Web.Hosting.ApplicationManager appManager, System.Web.Hosting.IApplicationHost appHost, System.Web.Configuration.IConfigMapPathFactory configMapPathFactory, System.Web.Hosting.HostingEnvironmentParameters hostingParameters, System.Security.Policy.PolicyLevel policyLevel) + 0x1d bytes [Appdomain Transition] System.Web.dll!System.Web.Hosting.ApplicationManager.CreateAppDomainWithHostingEnvironment(string appId, System.Web.Hosting.IApplicationHost appHost, System.Web.Hosting.HostingEnvironmentParameters hostingParameters) + 0x1278 bytes System.Web.dll!System.Web.Hosting.ApplicationManager.CreateAppDomainWithHostingEnvironmentAndReportErrors(string appId = "/LM/W3SVC/24/ROOT", System.Web.Hosting.IApplicationHost appHost, System.Web.Hosting.HostingEnvironmentParameters hostingParameters) + 0x2f bytes System.Web.dll!System.Web.Hosting.ApplicationManager.GetAppDomainWithHostingEnvironment(string appId, System.Web.Hosting.IApplicationHost appHost, System.Web.Hosting.HostingEnvironmentParameters hostingParameters) + 0x67 bytes System.Web.dll!System.Web.Hosting.ApplicationManager.CreateObjectInternal(string appId, System.Type type = {Name = "PipelineRuntime" FullName = "System.Web.Hosting.PipelineRuntime"}, System.Web.Hosting.IApplicationHost appHost, bool failIfExists = true, System.Web.Hosting.HostingEnvironmentParameters hostingParameters) + 0x4d bytes System.Web.dll!System.Web.Hosting.ProcessHost.StartApplication(string appId = "/LM/W3SVC/24/ROOT", string appPath, out object runtimeInterface = null) + 0x189 bytes
Monday, October 17, 2011 12:57 PM
All replies
-
User-782232518 posted
That folder is the one used by ASP.NET runtime to store site binaries for ASP.NET web site projects (which are too old and too special), which should be ACLed to restrict access. IIS application pool identities should have the permissions by default, while IIS Express runs under your account, which might not have the necessary permissions.
Thus, on a development machine you can safely change the settings to allow your account's access and avoid this exception.
In another word, IIS Express was designed primarily for new ASP.NET project types (web applications and so on). So it is expected that for web site projects, certain tunings are needed manually.
Friday, October 9, 2015 5:57 AM