加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

asp.net – 在.NET 4.5 Azure部署中找不到编译器可执行文件csc.e

发布时间:2020-12-16 04:26:02 所属栏目:asp.Net 来源:网络整理
导读:我有一个网站,并且有效: ASP.NET 4 MVC 3 实体框架4.3 在Azure Web角色中运行(我注意到它是osFamily =“1”,这很奇怪,因为我预计它是2 – 但无论如何…) Azure SDK 1.7 我已经升级了我的整个代码库,以便与大量的新玩具保持同步.现在它是: ASP.NET 4.5 MVC
我有一个网站,并且有效:

> ASP.NET 4
> MVC 3
>实体框架4.3
>在Azure Web角色中运行(我注意到它是osFamily =“1”,这很奇怪,因为我预计它是2 – 但无论如何…)
> Azure SDK 1.7

我已经升级了我的整个代码库,以便与大量的新玩具保持同步.现在它是:

> ASP.NET 4.5
> MVC 4(Razor 2)
>实体框架5
> Azure配置设置为osFamily =“3”
> Azure SDK 1.8(存储客户端库精心升级到2而不是1.7)

当我在分段中访问该站点时,我得到一个黄色的死亡屏幕,说无法找到编译器可执行文件csc.exe.我的问题是为什么?

它在本地工作正常,在发布模式下也是如此.我转发了,实例肯定运行Windows Server 2012(因此.NET 4.5 ??我已经看到它很难说,因为.NET 4.5替换了.NET 4文件夹中的.NET 4程序集).

根据响应头,它肯定运行IIS 8但有趣的是它声称X-ASPNET-VERSION是4.xxxx.对于ASP.NET 4站点来说这是正常的吗?

更新:

我针对.NET 4框架并将osFamily更改为2,现在可以正常工作了.所以我现在怀疑我有一个使用.NET 3.5或2的第三方程序集(事实上我确定我这样做)但是当针对的.NET框架高于导入程序集中引用的.NET框架时,会使用更高版本的框架??

osFamily =“3”只安装了.NET 4和4.5,所以我猜这是错误的原因,但我对目标的事情不对吗?我想使用osFamily =“3”我该怎么办?

堆栈跟踪

[InvalidOperationException: Compiler executable file csc.exe cannot be found.]
   System.CodeDom.Compiler.RedistVersionInfo.GetCompilerPath(IDictionary`2 provOptions,String compilerExecutable) +8675071
   Microsoft.CSharp.CSharpCodeGenerator.FromFileBatch(CompilerParameters options,String[] fileNames) +739
   Microsoft.CSharp.CSharpCodeGenerator.FromSourceBatch(CompilerParameters options,String[] sources) +3293761
   Microsoft.CSharp.CSharpCodeGenerator.System.CodeDom.Compiler.ICodeCompiler.CompileAssemblyFromSourceBatch(CompilerParameters options,String[] sources) +64
   HibernatingRhinos.Profiler.Appender.Util.GenerateAssembly.Compile(String fileName,String[] sources,IEnumerable`1 assembliesToReference) +1252
   HibernatingRhinos.Profiler.Appender.Util.GenerateAssembly.CompileAssembly(IEnumerable`1 sourcesResources,IEnumerable`1 assembliesToReference,String assemblyName) +118
   HibernatingRhinos.Profiler.Appender.EntityFramework.EntityFrameworkProfiler.SetupDatabaseDefaultConnectionFactoryIfNeeded() +929
   HibernatingRhinos.Profiler.Appender.EntityFramework.EntityFrameworkProfiler.SetupEntityFrameworkIntegration() +80
   HibernatingRhinos.Profiler.Appender.EntityFramework.EntityFrameworkProfiler.Initialize(EntityFrameworkAppenderConfiguration configuration) +47
   HibernatingRhinos.Profiler.Appender.EntityFramework.EntityFrameworkProfiler.Initialize() +73
   Web4.MvcApplication.Application_Start() +17

[HttpException (0x80004005): Compiler executable file csc.exe cannot be found.]
   System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context,HttpApplication app) +12864673
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext,HttpContext context,MethodInfo[] handlers) +175
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state,MethodInfo[] handlers,IntPtr appContext,HttpContext context) +304
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext,HttpContext context) +404
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +475

[HttpException (0x80004005): Compiler executable file csc.exe cannot be found.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +12881540
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +159
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr,HttpContext context) +12722601

解决方法

我有类似的问题.确保您的目标是正确的编译器.
我的目标是v4.5(但是应该有v4.0,因为现在有4.5个编译器)

在web.config中检查

<system.web>
 <compilation debug="true" defaultLanguage="c#" optimizeCompilations="true" targetFramework="4.0">
</system.web>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读