2

I am using the Mono Tools from mono-tools.org and when I try to run my ASP MVC3 project in mono using the mono menu, I get the following error:

enter image description here

Is there a way to set to compile using the .net 4 compiler? I have set targetFramework in the project file to v4.0.

I have also tried setting the command line argument on the mono-tools advanced page to be --with-profile4=yes which still results in the same error.

Output from mono --version

Mono JIT compiler version 2.10.2 (tarball) 
Copyright (C) 2002-2011 Novell, Inc and Contributors. www.mono-project.com
    TLS:           normal
    SIGSEGV:       normal
    Notification:  Thread + polling
    Architecture:  x86
    Disabled:      none
    Misc:          softdebug
    LLVM:          supported, not enabled.
    GC:            Included Boehm (with typed GC and Parallel Mark)
Darbio
  • 11,286
  • 12
  • 60
  • 100

1 Answers1

2

The targetFramework attribute does not exist in this context -- by the time your application configuration is examined, the runtime has already been started. It needs to know what framework version before it even reads your web.config.

You need to handle this in your Apache configuration. See this question. You need to use the MonoServerPath Apache directive to tell Apache that the mod_mono hosting process is /usr/bin/mod-mono-server4 (or whatever the path is on your machine).

If you are deploying with XSP then you'd have to run xsp4.

(IIS is not special in this regard either -- you have to assign your application to an app pool, and you have to explicitly set the runtime version for each pool you create.)

Side note: If the tools you are using are adding this attribute to your configuration, this is a bug in that tool.

Community
  • 1
  • 1
cdhowie
  • 158,093
  • 24
  • 286
  • 300
  • I am using mono tools 2.0.8152 for visual studio, not running Mono on the production server. Mono tools has an option 'Run in mono' which tries to compile the web app before running it using mono rather than .net. – Darbio Aug 09 '11 at 03:11
  • It will probably be invoking `xsp4` for you then. Does the `targetFramework` attribute exist in your web.config, or is the tool adding it? – cdhowie Aug 09 '11 at 03:12
  • It exists in my web.config ``. It looks like the mono-tools are actually invoking a server using .net 2 - so this may be the key. But I can't find anywhere that says how to set the target to xsp4 – Darbio Aug 09 '11 at 03:17
  • Perhaps the build of the tools you are using is too old to know what v4 is? – cdhowie Aug 09 '11 at 03:18
  • I downloaded the tools about 30 mins ago, though it could be the case that they don;t support .net 4 – Darbio Aug 09 '11 at 03:19
  • 1
    Novell (the company who maintained and sold these tools) hasn't existed for some time; they were bought by Attachmate. The tools are not maintained anymore. – cdhowie Aug 09 '11 at 03:21