Mono, mvc, razor, Googlefu #help



  • So i'd like to dabble in testing the changes mono has been working on since the windows open sourcing, but my Google fu seems weak in what I'm looking for.

    The goal: set up a Linux server (distro unimportant, but I'd like Ubuntu server for consistency across the test environment.) That runs mono 4.02+ (beta 4.2 is OK) BUT also runs .net46 and the most recent mvc/razor fancies.

    Seems easy enough right?

    Well, everything i can find seems to reference mvc 2 or 3, and mono 3.2.x or earlier.

    If anybody has any magic incantation books that lead to a more recent environment setup tutorial, I'd appreciate it.

    Of note: apache2, nginx, xsp Web servers don't matter, i just want something that actually works.



  • @Matches said:

    i just want something that actually works.

    Windows? :trolleybus:


  • sockdevs

    In terms of getting started with MVC 5, I've yet to find anything better than here: http://www.asp.net/mvc. And in terms of Razor, every MVC3 example I've found works equally well under MVC5; I don't recall anything in Razor that's MVC4/5-specific. After that though, I agree, it's hard to find good info.



  • You're aware this is about a mono Linux server, and not the framework? I'm quite experienced with windows+.net mvc stuff.


  • sockdevs

    Oh.

    In that case, I'll toddle off elsewhere to make room for people who know what they're talking about ;)



  • I just did

    sudo apt-get install mono-complete 
    

    on my debian jessie. It's installing like 200 packages. Will let you know what I end up with.



  • @cartman82 said:

    Will let you know what I end up with.

    No luck.

    $ mono -V
    Mono JIT compiler version 3.2.8 (Debian 3.2.8+dfsg-10)
    

    There are two other solutions

    1. Add a package source with newer stuff
    2. Build from sources

    Looking into it.



  • Mono 4.0 is in Debian only in experimental so far.



  • Go here:

    Copy paste the commands from the first box into your console.

    sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
    echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list
    sudo apt-get update
    

    Then try:

    apt-cache policy mono-complete
    

    You should get:

    mono-complete:
      Installed: 3.2.8+dfsg-10
      Candidate: 4.0.4.1-0xamarin1
      Version table:
         4.0.4.1-0xamarin1 0
            500 http://download.mono-project.com/repo/debian/ wheezy/main amd64 Packages
     *** 3.2.8+dfsg-10 0
            500 http://ftp.us.debian.org/debian/ testing/main amd64 Packages
            100 /var/lib/dpkg/status
    

    3.2.8 is the version I got from my distribution. 4.0.4 is from the xamarin directly. I'm not gonna dig further, but at this point, I should be able to enter the commands from the official site and get the upgrade installed.

    The package mono-devel should be installed to compile code.

    The package mono-complete should be installed to install everything - this should cover most cases of “assembly not found” errors.

    The package referenceassemblies-pcl should be installed for PCL compilation support - this will resolve most cases of “Framework not installed: .NETPortable” errors during software compilation.

    The package ca-certificates-mono should be installed to get SSL certificates for HTTPS connections. Install this package if you run into trouble making HTTPS connections.



  • Regarding building specific versions of mono:

    Pick your mono tarball of preference from here: http://download.mono-project.com/sources/mono/

    Then do the standard configure; make; sudo make install as outlined here:

    You'll want to set aside at least 25 minutes per make

    If you want to get fancy and compare different mono environments, then take a look at this: http://www.mono-project.com/docs/compiling-mono/parallel-mono-environments/



  • Ugh, no! NO!

    This is literally the last resort.

    Building something with this many moving parts is not trivial. I remember trying to build mono stuff at one point. Wasted a lot of time, and ended up missing a whole bunch of things (random reference errors, crashes etc).

    This is for experienced people with a lot of time only. A linux noob should stick to packages.



  • Really? I've done it like 10 times without any problems. If you want a specific version of mono, this is a much better alternative than whatever random version apt-get wants to give you...



  • @tar said:

    Really? I've done it like 10 times without any problems. If you want a specific version of mono, this is a much better alternative than whatever random version apt-get wants to give you...

    In general, yes.

    And if you happen to have all prerequisites available in repositories, then there's a solid chance things will go smoothly.

    But for a linux noob who just wants a generic "recent" version to play around with, apt-get is the way to go.



  • I'm not sure there's any dependencies outside of GCC and make tbh. Anyway, all I'm doing is outlining Plan B, if the apt chicanery doesn't pan out...
    It's always good to have options, right?



  • If I may insert an unrelated rant (in the sense that ASP.NET-MVC is a apparently unrelated to the usual model of MVC in any sane sense :smile:)

    The Model-View-Controller paradigm is one of the many, many things in this field that gets the silver-bullet treatment, and the everything-is-a-nail treatment as well. MVC is a usable and useful solution to the problem of organizing the relationship between the presentation of data on one or more remote clients, the handling of data within the program on the server, and the data management within the core database.

    And that's it.

    It is a high-level model of how to separate concerns. It isn't a goddamn framework, or a methodology, or a library, and it damn well isn't something that has to touch every single aspect of the program. It is a way of organizing, not a way of life.

    It's a lot like how OOP was played up in the early 1990s. When people outside of Xerox PARC started to understand that object-oriented programming was a good fit for WIMP GUIs, they decided it had to be a good fit for everything, and suddenly everything was objects everywhere. When older programmers pushed back - usually for BS reasons, admittedly - they got steamrollered rather than having their concerns (legitimate or otherwise) addressed. The result was that the solutions to problems often got worse, rather than better.

    OOP is great for some things, but stinks on ice for others. The same applies to every single paradigm out there, except the bottom-line iterative/procedural paradigm, which is uniformly mediocre for all purposes.

    My point is that there is no silver bullet, and the world has a lot of things that aren't nails. We are at such an early stage of the field's development it isn't funny. We are nowhere near coming up with a Grand Unified Theory of Everything for software development, and it may be that one will never be found. So why do people keep insisting they've found one?

    And yes, I know how this must sound coming from me. But you'll notice I never claimed Lisp was better, just that it was better for me. I like it, and like to suggest that others take another look at it. I'm not going to tell them that it is the answer for everything, just one more tool that they should have in their toolkits. The same is true of most languages, and while there are some I hate, there are very few I won't ever use.



  • apt-get install mono-complete allows you to run C# applications, but it's not the web server. You can run something like mono MyApplication.exe and it will run (usually without modification, but YMMV) -- Typically console apps translate well.

    In order to get the 4.x+ versions on debian/ubuntu, you need to add the PPA for someone's github.

    But again - the issue is not with installing mono but with installing the mvc / razor support for either mod_mono (apache2) or XSP



  • More or less accurate, but in this sense an MVC application has an application entry point that routes to a global set of configurations for routes, configurations, etc. and allows you to have controllers, view models, and views. These views are also slightly different than standard web forms (which the mono web framework actually support kind of out of the box)

    The main problem I'm hitting is that I can't actually figure out how to get XSP4 or mod_mono to serve a recent version of the mono version MVC / razor stuff - and I REALLY don't want to use web forms for this project.

    Of note: Mono-Complete is only for the raw c# stuff. There's no web components in there in terms of server serving client. (There are things like http web requests, but I'm not going to go into the nuances of that)

    Filed under: Markdown Golf



  • This is so blatantly off-topic. Why the hell aren't you people using the "reply in new topic" link?



  • Yay!

    Holy shit, was that an unpleasant experience to set up.

    Theoretically, all you have to do is

    1. apt-get install monodevelop
    2. apt-get install mono-xsp4
    3. Create new "ASP.NET MVC with razor" project
    4. Microsoft's MVC libraries should come from nuget. This is my packages.config
    <?xml version="1.0" encoding="utf-8"?>
    <packages>
      <package id="Microsoft.AspNet.Mvc" version="5.2.3" targetFramework="net45" />
      <package id="Microsoft.AspNet.Razor" version="3.2.3" targetFramework="net45" />
      <package id="Microsoft.AspNet.WebPages" version="3.2.3" targetFramework="net45" />
      <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net45" />
    </packages>
    
    1. Run

    Of course, in reality, there was a LOT of issues before I got this far, including:

    • MonoDevelop crashing until I installed a mysterious .NET 2.x library. And then uninstalled it. Maybe?
    • Web site crashing with a message it can't access various dirs on the machine. Turns out they needed to be created.
    • Project saying it can't find MVC assemblies. Then finding them after clean / rebuild / start new project from scratch
    • Incorrect version numbers for some assemblies in the config file

    But anyway. Seems to be working now.

    Seriously, MS needs to work MUCH harder if they expect linux people to start flocking towards their platform.



  • Fair enough; I even said as much at the start of the rant, I just didn't think to use 'reply as linked topic' at the time. Call it a brain-fart I guess - it is a feature few other fora have, so I'm not used to using it. If the mods want to relocate it to a new thread, I have no problem with that.



  • @cartman82 said:

    Holy shit, was that an unpleasant experience to set up.

    So what steps did you actually follow? (Or did you rewrite it in such a way that that is actually what you did)

    Also: Microsoft doesn't (Or hasn't historically) had any association with the mono project. It's (or it was) completely independent. When Microsoft open sourced the .net core, mono took a giant leap forward since they had access to things like the garbage collector code and all the other cool shit mono historically lacked.

    Only very VERY recently has Microsoft announced plans to include a switching mechanism to transparently (allegedly) switch between Linux and windows application stacks, and not really provided much detail to what that actually means.

    Also, That page is exactly what I'm trying to reach, so that's pretty sexy.

    Is that page an actual MVC route, or just an aspx page?



  • @Matches said:

    So what steps did you actually follow? (Or did you rewrite it in such a way that that is actually what you did)

    That's what I did, with various troubleshootings and delays in between the steps.

    Try just creating a new MVC Razor project in monodevelop and see if nuget solves your problem. Then go from there, post here if there's an error or something.



  • @Matches said:

    Is that page an actual MVC route, or just an aspx page?



  • Will give it a whirl when I get home in a couple hours, will let you know if i blow anything up with the magical incantatum.

    [Edit to your picture] Nice - That's what I was looking for.

    The real magic will be once I get that working, getting visual studio to work with it =P



  • @ScholRLEA said:

    It is a high-level model of how to separate concerns. It isn't a goddamn framework, or a methodology, or a library, and it damn well isn't something that has to touch every single aspect of the program.

    Actually, depending on your meaning, it can be all of those.

    @ScholRLEA said:

    The Model-View-Controller paradigm is one of the many, many things in this field that gets the silver-bullet treatment, and the everything-is-a-nail treatment as well.

    Whoah dude, that's so 2013. Everyone's running away from MVC now. These days it's all about microservices and component based design. Get with the times.



  • So apparently my virtualbox network connections aren't working any more after the windows 10 upgrade. Every single fucking one of my VMs is unbootable because the network no longer exists.

    [Edit] Ok, rage averted, running the virtualbox repair made things work again.

    The real trick appears to be how to actually deploy the mono site to the linux mono xsp4 server. You're actually running it through the monodevelop editor, and not running a stand alone instance.


  • Impossible Mission Players - A

    @cartman82 said:

    Get with the times.
    snorts awake Wait, huh, um, what?


    Filed under: What do you mean it's 2015? I just barely got a machine with VS 2012 installed on it!


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.