MVC3项目迁移到win7 64位机后无法正确加载dll
IT 最近将我从 win xp 32 位计算机转移到 Win 7 Enterprise 64 位计算机。安装 VS2010、MVC3 和各种其他组件后,我提取了我正在处理的 MVC3 项目的最新版本。当我运行调试器时,出现黄屏死机,它引用了解决方案中另一个项目的 dll,并显示以下错误代码:
无法加载文件或程序集“Core”或其依赖项之一。访问被拒绝。 描述:执行当前 Web 请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其在代码中的来源的更多信息。
和堆栈跟踪:
[FileLoadException:无法加载文件或程序集“Core”或其依赖项之一。访问被拒绝。]
[FileLoadException:无法加载文件或程序集“Core,Version=1.0.0.0,Culture=neutral,PublicKeyToken=null”或其依赖项之一。访问被拒绝。] System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, 布尔值 throwOnFileNotFound, 布尔值 forIntrospection, 布尔值抑制SecurityChecks) +0 System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, 布尔值 throwOnFileNotFound, 布尔值 forIntrospection, 布尔值抑制SecurityChecks) +39 System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef,证据 assemblySecurity,StackCrawlMark 和 stackMark,布尔值 forIntrospection,布尔值抑制SecurityChecks)+132 System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +144 System.Reflection.Assembly.Load(字符串 assemblyString)+28 System.Web.Configuration.CompilationSection.LoadAssemblyHelper(字符串程序集名称,布尔星指令)+46
[ConfigurationErrorsException:无法加载文件或程序集“Core,Version=1.0.0.0,Culture=neutral,PublicKeyToken=null”或其依赖项之一。访问被拒绝。] System.Web.Configuration.CompilationSection.LoadAssemblyHelper(字符串程序集名称,布尔星指令)+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 托管参数,PolicyLevel 策略级别,异常 appDomainCreationException)+677
[HttpException (0x80004005):无法加载文件或程序集“Core,Version=1.0.0.0,Culture=neutral,PublicKeyToken=null”或其依赖项之一。访问被拒绝。] System.Web.HttpRuntime.FirstRequestInit(HttpContext上下文)+8972240 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext上下文)+97 System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr)+258
它在另一台计算机上运行良好,并且可以在服务器上正常加载。是否有任何安全问题或我忽略的任何问题,我是 win7 64 位环境的新手?或者还有什么我忘记解释的事情对你们中的一个人来说是显而易见的?
编辑:我也尝试过 IIS Express 7.5,但最终结果相同。
EDIT2:我暂时解决了这个问题,方法是在本地调试时禁用 web.config 文件中的模拟,并将该行添加到发布转换中以便在服务器上部署。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否在专用帐户下运行应用程序池?也就是说,除了网络服务之外还有什么?如果是这样,您需要添加对 asp.net 临时文件目录的权限。
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.