ASPX页面加载C#报错

来源:互联网 发布:谷歌浏览器mac 编辑:程序博客网 时间:2024/06/05 00:56
这个错误查了好久,我的Web程序之前都是可以运行的,今天突然发现不能执行了,可以正常发布,发布的web程序在服务器上也正常,只是在VS2012上无法执行,报错如下:
异常信息:
 
   异常类型:ConfigurationErrorsException
    异常消息:未能加载文件或程序集“Microsoft.CSharp, Version=4.0.0.0, Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a”或它的某一个依赖项。未提供所需的模拟级别,或提供的模拟级别无效。(异常来自 HRESULT:0x80070542)
   在System.Web.Configuration.CompilationSection.LoadAssemblyHelper(StringassemblyName, Boolean starDirective)
   在System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfoai)
   在System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSectioncompConfig)
   在System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies()
   在System.Web.Compilation.BuildManager.CallPreStartInitMethods(StringpreStartInitListPath, Boolean& isRefAssemblyLoaded)
   在System.Web.Compilation.BuildManager.ExecutePreAppStart()
   在System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManagerappManager, IApplicationHost appHost, IConfigMapPathFactoryconfigMapPathFactory, HostingEnvironmentParametershostingParameters, PolicyLevel policyLevel, ExceptionappDomainCreationException)

未能加载文件或程序集“Microsoft.CSharp, Version=4.0.0.0, Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a”或它的某一个依赖项。未提供所需的模拟级别,或提供的模拟级别无效。(异常来自 HRESULT:0x80070542)
   在System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName,String codeBase, Evidence assemblySecurity, RuntimeAssemblylocationHint, StackCrawlMark& stackMark, IntPtrpPrivHostBinder, Boolean throwOnFileNotFound, BooleanforIntrospection, Boolean suppressSecurityChecks)
   在System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName,String codeBase, Evidence assemblySecurity, RuntimeAssemblylocationHint, StackCrawlMark& stackMark, IntPtrpPrivHostBinder, Boolean throwOnFileNotFound, BooleanforIntrospection, Boolean suppressSecurityChecks)
   在System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyNameassemblyRef, Evidence assemblySecurity, RuntimeAssemblyreqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder,Boolean throwOnFileNotFound, Boolean forIntrospection, BooleansuppressSecurityChecks)
   在System.Reflection.RuntimeAssembly.InternalLoad(StringassemblyString, Evidence assemblySecurity, StackCrawlMark&stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection)
   在System.Reflection.RuntimeAssembly.InternalLoad(StringassemblyString, Evidence assemblySecurity, StackCrawlMark&stackMark, Boolean forIntrospection)
   在System.Reflection.Assembly.Load(String assemblyString)
   在System.Web.Configuration.CompilationSection.LoadAssemblyHelper(StringassemblyName, Boolean starDirective)





这是系统日志的报错信息,在网上查了很久,网友大多数给出的解决办法是:
1.检查“目标框架”与web.config配置是否一致。
2.检查引用的Microsoft.CSharp.dll是否有问题。
3.使用管理员权限启动VS。

最后我是用第三种方法解决的!很坑,搞了很久。。。。。。

0 0
原创粉丝点击