Mono+jexus deploying MVC's various pits

Source: Internet
Author: User
Tags stack trace

The people mentioned here do not repeat, only said to check for a long time to know.

Pit No. 1th:System.IO.FileNotFoundException Could not find File "Roslyn\csc.exe".
Detailed information is as follows:

System.IO.FileNotFoundExceptionCould not find file"/var/www/defalut/bin\roslyn\csc.exe". Description:http -. Error processing request. Details:non-web exception. Exception origin (name of application orObject): mscorlib. Exception Stack trace:at System.IO.FileStream. ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 buffersize, Boolean Anonymous, Fileopti ONS options)<0x41aaab70+0x006e7>inch<filename Unknown>:0At System.IO.FileStream. ctor (System.String path, FileMode mode, FileAccess access, FileShare share)<0x41bba470+0x00053>inch<filename Unknown>:0At (wrapper remoting-invoke-with-check) System.io.filestream:.ctor (string, System.io.filemode,system.io.fileaccess,system.io.fileshare) at System.IO.File.OpenRead (System.String path) <0x41bc4b50+0x0003f>inch<filename Unknown>:0At Microsoft.CodeDom.Providers.DotNetCompilerPlatform.Compiler.get_CompilerName ()<0X41E0FB40+0x00086>inch<filename Unknown>:0At Microsoft.CodeDom.Providers.DotNetCompilerPlatform.Compiler.FromFileBatch ( System.CodeDom.Compiler.CompilerParameters options, system.string[] fileNames)<0x41e1d600+0x005ce>inch<filename Unknown>:0 

Only a part of it, but a general look can also see the path is a problem, the cause of the problem:

http://www.mono-project.com/docs/advanced/iomap/

The explanations and solutions provided by the Mono official website are as follows:

The problem

Windows developers is used to a case-insensitive the file system, which means that they might create a file called "MyData" I n one place, and try to access it somewhere else as "MyData" or as "MyData". This breaks the Unix setups because UNIX is case sensitive[1].

Another problem is this developers sometimes hardcode the directory separator character in their source code ("\") instead of using Path.directoryseparator and using Path.Combine for combining this paths. This was a problem because "\" is a valid file name, on Unix. This means if a application hardcodes for example ' Logs\access_log ', in Unix this would not be store the contents in the "Logs" directory as the file "Access_log". Instead, it'll store the results in a file called "Logs\access_log".

Only a few applications cope with drive letters, but they might still pose a problem as the colon are a valid filename in U Nix, which means that "A:\file" was A valid filename in the current directory.

Although. NET provides the tools to write code, portable, in practice, they does not use these features (the exceptio N is path.combine, which some people use, as it's genuinely useful on its own).

The usual solution

When moving applications from Windows to Linux, it's always necessary to run of the application, run its test suite, and Val Idate that the application works as intended. With the path problems described above, the process above included a number of iterations to fix the assumptions made by P Rogrammers about the file system.

This process could is time consuming, because identifying where the mistakes were made could take some time, the program m ight fail with FileNotFound exceptions (when referencing files that were not there), the data would show up empty (listing con Tents of a directory that had nothing, as all the data went elsewhere) but it is doable.

This is a process works as long as you had the source code to all of the components that is porting, but if you were using a Third-party Library That's had no source code for, you would isn't be able to fix the problems.

The New Solution

Mono now have a portability layer into Mono that would address those problems without requiring changes to your code. This would remove a large component of the porting cycle as a whole class of obnoxious problems are gone.

The new portability framework is enabled by setting the environment variable Mono_iomap (which we'll likely rename to so Mething shorter) to one of the following values:

    • Case:makes all file system access case insensitive.
    • Drive:strips drive name from Pathnames.
    • All:enables both case and drive.

In addition, if any of those options is enabled, the directory separator mapping is also turned on. So this basically means, which has to the type this, or include the this in your script that launches your application:

   $ export mono_iomap=all   $ MONO myapp.exe

for ASP. Applications hosted with Mod_mono, you can add the following directive to your Apache configuration file:

Monosetenv Mono_iomap=all

This new feature appeared in Mono 1.1.18 and are available in all new Mono 1.2.x versions as well.

The downside is that Mono'll has to do some extra work when coping with your file system, to search for case Insensitiv e file names. So if your application are still a portable application, you'll be much better off without this switch.

[1] Some Linux file systems is case insensitive, and Some folks has used a combination of hacks, including doing Loopbac K CIFS mounts to get case sensitivity issues out of the the- OS X does not had this particular problem, but it still had the others.

Pit No. 2nd:System.InvalidOperationException Process has not been started.

Detailed information is as follows:

Description:http -. Error processing request. Details:non-web exception. Exception origin (name of application orObject): System.Exception stack trace:at System.Diagnostics.Process.get_ExitCode ()<0x414b69b0+0X000A3>inch<filename Unknown>:0At (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) <0x414b3ec0+0x00403>inch<filename Unknown>:0At System.CodeDom.Compiler.Executor.ExecWaitWithCapture (IntPtr usertoken, System.String cmd, System.String Currentdir, System.CodeDom.Compiler.TempFileCollection tempfiles, System.String& Outputname, system.string& ErrorName) <0x414b3c00+0x00057>inch<filename Unknown>:0At Microsoft.CodeDom.Providers.DotNetCompilerPlatform.Compiler.Compile ( System.CodeDom.Compiler.CompilerParameters options, System.String compilerfullpath, System.String arguments, System.String& OutputFile, system.int32& Nativereturnvalue) <0x414b37e0+0x0010b>inch<filename Unknown>:0At Microsoft.CodeDom.Providers.DotNetCompilerPlatform.Compiler.FromFileBatch ( System.CodeDom.Compiler.CompilerParameters options, system.string[] fileNames)<0x414b03e0+0x005ef>inch<filename Unknown>:0At Microsoft.CodeDom.Providers.DotNetCompilerPlatform.Compiler.CompileAssemblyFromFileBatch ( System.CodeDom.Compiler.CompilerParameters options, system.string[] fileNames)<0x414b0250+0x000c7>inch<filename Unknown>:0At System.CodeDom.Compiler.CodeDomProvider.CompileAssemblyFromFile ( System.CodeDom.Compiler.CompilerParameters options, system.string[] fileNames)<0x414b00b0+0x00049>inch<filename Unknown>:0at System.Web.Compilation.AssemblyBuilder.BuildAssembly (System.Web.VirtualPath virtualpath, System.CodeDom.Compiler.CompilerParameters options)<0X4149BD40+0x00979>inch<filename Unknown>:0At System.Web.Compilation.AssemblyBuilder.BuildAssembly (System.Web.VirtualPath virtualpath)<0x4149bd00+0x00023>inch<filename Unknown>:0at System.Web.Compilation.BuildManager.GenerateAssembly (System.Web.Compilation.AssemblyBuilder Abuilder, System.Web.Compilation.BuildProviderGroup Group, System.Web.VirtualPath VP, Boolean Debug)<0x414913e0+0x0097b>inch<filename Unknown>:0at System.Web.Compilation.BuildManager.BuildInner (System.Web.VirtualPath VP, Boolean Debug)<0x41444aa0+0x0050b>inch<filename Unknown>:0At System.Web.Compilation.BuildManager.Build (System.Web.VirtualPath VP)<0x41444520+0x000ff>inch<filename Unknown>:0At System.Web.Compilation.BuildManager.GetCompiledType (System.Web.VirtualPath virtualpath)<0x41443e20+0x0008f>inch<filename Unknown>:0At System.Web.Compilation.BuildManager.GetCompiledType (System.String virtualpath)<0x41443a50+0x00017>inch<filename Unknown>:0At System.Web.HttpApplicationFactory.InitType (System.Web.HttpContext context)<0x413dd430+0x003f3>inch<filename Unknown>:0 

To be Continued ...

Mono+jexus deploying MVC's various pits

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.