MVC3 project will not load dll properly aftering m

2019-08-08 03:20发布

问题:

IT recently moved me from a win xp 32-bit machine onto a Win 7 Enterprise 64-bit machine. After installing VS2010, MVC3 and various other components, I pulled the most current version of an MVC3 project I am working on. When I run the debugger, I get the Yellow Screen of Death, which references a dll from another project in my solution with the following error code:

Could not load file or assembly 'Core' or one of its dependencies. Access is denied. 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.

And the Stack Trace:

[FileLoadException: Could not load file or assembly 'Core' or one of its dependencies. Access is denied.]

[FileLoadException: Could not load file or assembly 'Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Access is denied.] System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0 System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +39 System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks) +132 System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +144 System.Reflection.Assembly.Load(String assemblyString) +28 System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +46

[ConfigurationErrorsException: Could not load file or assembly 'Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Access is denied.] System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +618 System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +209 System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +130 System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +178 System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() +94 System.Web.Compilation.BuildManager.CallPreStartInitMethods() +332 System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +677

[HttpException (0x80004005): Could not load file or assembly 'Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Access is denied.] System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +8972240 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +97 System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +258

It ran fine on the other machine, and will load on the server fine. Is there any security issues or anything I am overlooking, I am new to the win7 64 bit environment? Or is there something else I forgot to account for that is obvious to one of you?

EDIT: I have also tried IIS Express 7.5 with the same end result.

EDIT2: I resolved the issue for now by disabling impersonation in the web.config file while debugging locally, and adding the line to the release transform for deployment on the server.

回答1:

Are you running the app pool under a dedicated account? That is, something other than Network Service? If so you need to add permissions to the asp.net temporary files directory.