Visual Studio 2015在单声道上编译ASP.NET MVC网站模板 - System.InvalidOperationException

问题描述:

最近,我一直在尝试使用Mono来托管ASP.NET MVC应用程序,当试图运行使用Visual Studio 15构建的模板应用程序时,我得到以下错误:Visual Studio 2015在单声道上编译ASP.NET MVC网站模板 - System.InvalidOperationException

System.InvalidOperationException No process is associated with this object.

堆栈跟踪:

at System.Diagnostics.Process.EnsureState (System.Diagnostics.Process+State state) [0x0001e] in <affe4060066c42de8cdd6027cdb92b56>:0 
at System.Diagnostics.Process.get_HasExited() [0x0000b] in <affe4060066c42de8cdd6027cdb92b56>:0 
at System.Diagnostics.Process.EnsureState (System.Diagnostics.Process+State state) [0x00093] in <affe4060066c42de8cdd6027cdb92b56>:0 
at System.Diagnostics.Process.get_ExitCode() [0x00000] in <affe4060066c42de8cdd6027cdb92b56>:0 
at (wrapper remoting-invoke-with-check) System.Diagnostics.Process:get_ExitCode() 
at System.CodeDom.Compiler.Executor.InternalExecWaitWithCapture (System.String cmd, System.String currentDir, System.CodeDom.Compiler.TempFileCollection tempFiles, System.String& outputName, System.String& errorName) [0x000f1] in <affe4060066c42de8cdd6027cdb92b56>:0 
at System.CodeDom.Compiler.Executor.ExecWaitWithCapture (System.IntPtr userToken, System.String cmd, System.String currentDir, System.CodeDom.Compiler.TempFileCollection tempFiles, System.String& outputName, System.String& errorName) [0x00007] in <affe4060066c42de8cdd6027cdb92b56>:0 
at Microsoft.CodeDom.Providers.DotNetCompilerPlatform.Compiler.Compile (System.CodeDom.Compiler.CompilerParameters options, System.String compilerFullPath, System.String arguments, System.String& outputFile, System.Int32& nativeReturnValue) [0x00071] in <57d777233c3f47cfbcc22a12ce3dc52b>:0 
at Microsoft.CodeDom.Providers.DotNetCompilerPlatform.Compiler.FromFileBatch (System.CodeDom.Compiler.CompilerParameters options, System.String[] fileNames) [0x00170] in <57d777233c3f47cfbcc22a12ce3dc52b>:0 at Microsoft.CodeDom.Providers.DotNetCompilerPlatform.Compiler.CompileAssemblyFromFileBatch (System.CodeDom.Compiler.CompilerParameters options, System.String[] fileNames) [0x00048] in <57d777233c3f47cfbcc22a12ce3dc52b>:0 
at System.CodeDom.Compiler.CodeDomProvider.CompileAssemblyFromFile (System.CodeDom.Compiler.CompilerParameters options, System.String[] fileNames) [0x00014] in <affe4060066c42de8cdd6027cdb92b56>:0 
at System.Web.Compilation.AssemblyBuilder.BuildAssembly (System.Web.VirtualPath virtualPath, System.CodeDom.Compiler.CompilerParameters options) [0x002f5] in <80d482637b7943f8b4edcf91864a2ce4>:0 
at System.Web.Compilation.AssemblyBuilder.BuildAssembly (System.Web.VirtualPath virtualPath) [0x00008] in <80d482637b7943f8b4edcf91864a2ce4>:0 
at System.Web.Compilation.BuildManager.GenerateAssembly (System.Web.Compilation.AssemblyBuilder abuilder, System.Web.Compilation.BuildProviderGroup group, System.Web.VirtualPath vp, System.Boolean debug) [0x00264] in <80d482637b7943f8b4edcf91864a2ce4>:0 
at System.Web.Compilation.BuildManager.BuildInner (System.Web.VirtualPath vp, System.Boolean debug) [0x0011c] in <80d482637b7943f8b4edcf91864a2ce4>:0 
at System.Web.Compilation.BuildManager.Build (System.Web.VirtualPath vp) [0x00063] in <80d482637b7943f8b4edcf91864a2ce4>:0 
at System.Web.Compilation.BuildManager.GetCompiledType (System.Web.VirtualPath virtualPath) [0x00040] in <80d482637b7943f8b4edcf91864a2ce4>:0 
at System.Web.Compilation.BuildManager.GetCompiledType (System.String virtualPath) [0x00006] in <80d482637b7943f8b4edcf91864a2ce4>:0 
at System.Web.HttpApplicationFactory.InitType (System.Web.HttpContext context) [0x00179] in <80d482637b7943f8b4edcf91864a2ce4>:0 

我使用FastCGI单服务器上Nginx的,操作系统是Debian的舒展。

要检查这是否是服务器配置问题,我部署了一个使用Visual Studio 13创建的网站,它的工作原理没有任何问题。为了设置服务器,我主要关注mono docs for nginx

首先的问题,我曾与VS15创建的项目是:

Could not find file "/var/www/html/mono/bin\roslyn\csc.exe".

所以我用了MONO_IOMAP =所有设定(不知道这是解决这一问题的适当办法)。之后,我得到了我之前提到的例外情况。

两个站点(使用VS13和模板构建的工作站)都以.NET Framework 4.5为目标。唯一大的区别,我能找到在Web.config文件中的这一部分(在新的网站上发现):

<system.codedom> 
    <compilers> 
     <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701" /> 
     <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+" /> 
    </compilers> 
    </system.codedom> 

我怀疑,这个问题以某种方式与事实VS15使用罗斯林编译器相连接。任何帮助是极大的赞赏。

仔细检查错误信息并比较VS2013/2015项目,您应该看到CompilerPlatform位是罪魁祸首。

微软公司主要为.NET设计,所以它在Mono上工作不太好。您可以将其从您的项目中移除,转而使用Mono或完全切换到.NET Core。

+0

我明白了。 .NET Core看起来不错。我想它没有.NET框架的完整功能,所以你有任何列表详细说明什么是缺少的? – badyl

+0

@badyl我不知道,但微软有一些在https://docs.asp.net –