2016-09-28 75 views
1

最近,我一直在嘗試使用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使用羅斯林編譯器相連接。任何幫助是極大的讚賞。

回答

0

仔細檢查錯誤信息並比較VS2013/2015項目,您應該看到CompilerPlatform位是罪魁禍首。

微軟公司主要爲.NET設計,所以它在Mono上工作不太好。您可以將其從您的項目中移除,轉而使用Mono或完全切換到.NET Core。

+0

我明白了。 .NET Core看起來不錯。我想它沒有.NET框架的完整功能,所以你有任何列表詳細說明什麼是缺少的? – badyl

+0

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

相關問題