[Mono-list] Running ASP.Net 4.5 MVC Application on Mono
Martin Thwaites
monoforum at my2cents.co.uk
Tue Sep 16 21:13:55 UTC 2014
That last error is misleading. I think someone did look into fixing the
error message. It basically masks the underlying error. Check your logs,
you'll probably see the actual error.
In terms of the packages ending up in bin... From your description you
appear to missing how references work. Deleting the nuget packages doesn't
stop things from being copied in. It's how you define the reference in the
csproj file (by defining "copy local" as true). Apologies if you knew
that, but your description wasn't clear.
Also, you shouldn't really be referencing the assemblies with a full path,
you should do it through the GAC.
There was a PR for the append trailing slash one, not sure where it ended
up though.
What I would say though is, what are you using that requires MVC 4? Could
you revert to MVC3? As that does work on mono.
On 16 Sep 2014 20:07, "Fernando Rodriguez" <frodriguez.developer at outlook.com>
wrote:
> Thanks for the replies.
>
> I did made some progress, that specific error is my xsp was quite old, I
> built
> it from the latest tarball on Mono's website but it is outdated, so I had
> to
> get it from github.
>
> After that I got another missing method exception:
> System.Web.Routing.RouteCollection.get_AppendTrailingSlash. This method
> does
> not exist currently in mono (I read it's on the current github tree but
> not on
> releases). So obviously it's because my app was using MS assemblies.
>
> So I installed Mono and MonoDevelop 5.1 from tarballs on a desktop. Then
> opened the solution removed all Package References and added References to
> the
> right assemblies on /usr/local/lib/mono/4.5 and deleted everything in the
> bin
> directory. It still wouldn't compile because it doesn't find the ViewBag
> property on the Controller class (I guess because it's a dynamic type and I
> guess Mono can't handle it), so I created quick custom ViewBag extension
> and
> it compiled but I still get the same error so I look on the bin directory
> and
> they're back! I don't know where MonoDevelop got them cause I deleted them
> from packages directory. So I deleted everything from the bin directory
> except
> for my DLL and a couple third party DLLs (everything else is in the GAC),
> then
> without recompiling I ran from my project directory root.
>
> xsp4 --root . --applications /:.
>
> now I'm getting:
>
> System.InvalidOperationException
> The view 'Index' or its master was not found or no view engine supports the
> searched locations. The following locations were searched:
> ~/Views/Default/Index.aspx
> ~/Views/Default/Index.ascx
> ~/Views/Shared/Index.aspx
> ~/Views/Shared/Index.ascx
> ~/Views/Default/Index.cshtml
> ~/Views/Default/Index.vbhtml
> ~/Views/Shared/Index.cshtml
> ~/Views/Shared/Index.vbhtml
>
>
> But Views/Default/Index.cshtml is there with rwx permission for everyone.
> As a
> desperate move I even tried copying the View directory to my home
> directory in
> case it was interpreting ~ to be my home dir instead of the app root. So
> right
> now I'm stuck. I'm using the right case on the url. Any suggestions?
>
>
>
>
>
> On Tuesday 16 September 2014 3:32:31 PM Martin Thwaites wrote:
> > Have you made sure to remove the Microsoft.Web.Infrastructure.dll file...
> >
> > There is a tutorial somewhere about running MVC 3 on mono (which I do
> with
> > great success). There a few files that you need to make sure are not
> > deployed as part of your application.
> >
> > That said, I've not tried anything 4.5 related on mono yet.
> >
> > Also, you could try compiling from git, it maybe more upto date that the
> > tarball.
> >
> > Hope that helps
> > Martin
> > On 16 Sep 2014 05:41, "Fernando Rodriguez"
> <frodriguez.developer at outlook.com>
> > wrote:
> >
> > > Hi,
> > >
> > > I'm trying to get an Asp.Net 4.5 MVC app to run on mono and I'm getting
> the
> > > error shown bellow (also posted here). I get the same error in apache
> using
> > > mod_mono as in xsp4. I built mono, xsp, and mod_mono on the server from
> the
> > > latest tarball releases (simple ./configure && make && make install).
> Other
> > > Asp.Net applications run fine on the same server (targetting earlier
> > > runtimes).
> > > The server run Gentoo and I remove all mono, xsp, and mod_mono packages
> > > before
> > > building the source.
> > >
> > > I found several posts that suggest a bug in xsp (don't apply since I'm
> > > using
> > > latest tarball and also tried earlier versions) or mono loading the
> wrong
> > > framework version stack trace and exception message suggest is loading
> the
> > > right assemblies (most assemblies on the 4.5 directory are symlinks to
> > > 4.0). I
> > > did tried to run xsp.exe with mono ---runtime=v4.5 and it tells me it's
> not
> > > available, same for 4.0 but it is available and the and the exception
> shows
> > > it's using it.
> > >
> > > The application was built on Windows with Visual Studio but I also
> built
> on
> > > MonoDevelop (Xamarin) on Windows to target Mono. It does not use any
> > > external
> > > references except for PayPal's API Library but I used this same
> library on
> > > other applications that run on mono so that shouldn't be the problem.
> I'm
> > > trying to setup a parallel mono environment on a Linux desktop to
> compile
> > > it
> > > on Linux to see if it makes a difference (my distro's version are
> really
> > > outdated).
> > >
> > >
> > > Another thing I noticed is that Visual Studio copies all the Mvc and
> Razor,
> > > etc assemblies to the bin folder, if I delete them mono wines about not
> > > finding
> > > them even though there's Mono's implementation on the GAC (which I
> believe
> > > are
> > > built from the same source). Also in the Visual Studio generated
> > > Web.config the
> > > <httpRuntime> and other tags had a targetFramework="4.5" attribute,
> and I
> > > had
> > > to remove it cause mono wined about it (unrecognized attribute or
> something
> > > like that). Yet the same Web.config works fine in Mono under Windows.
> > >
> > > I think that's all I got, suggestions are appreciated.
> > >
> > > Exception caught during reading the configuration file:
> > > System.MissingMethodException: Method not found:
> > > 'System.Configuration.IConfigurationSectionHandler.Create'.
> > > at
> > >
> > >
>
> System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection
> > > (System.String configKey) [0x00000] in <filename unknown>:0
> > > at System.Configuration.ConfigurationManager.GetSection
> (System.String
> > > sectionName) [0x00000] in <filename unknown>:0
> > > at System.Configuration.ConfigurationManager.get_AppSettings ()
> > > [0x00000] in
> > > <filename unknown>:0
> > > at Mono.WebServer.XSP.Server.get_AppSettings () [0x00000] in
> <filename
> > > unknown>:0
> > > at Mono.WebServer.XSP.Server+ApplicationSettings..ctor () [0x00000]
> in
> > > <filename unknown>:0
> > > xsp4
> > > Listening on address: 0.0.0.0
> > > Root directory: /var/www/stage.fernansoft.net
> > > Listening on port: 8080 (non-secure)
> > > Hit Return to stop the server.
> > > Missing method
> > >
> > >
>
> System.Configuration.IConfigurationSectionHandler::Create(object,object,XmlNode)
> > > in assembly /usr/local/lib64/mono/4.0/System.dll, referenced in
> assembly
> > > /usr/local/lib64/mono/4.0/System.Configuration.dll
> > > Missing method
> > > System.Configuration.ConfigurationManager::get_AppSettings() in
> > > assembly
> > >
> > >
>
> /usr/local/lib64/mono/gac/System.Configuration/4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll,
> > > referenced in assembly
> > >
> > >
>
> /usr/local/lib64/mono/gac/Mono.WebServer2/0.4.0.0__0738eb9f132ed756/Mono.WebServer2.dll
> > > Missing method
> > > System.Configuration.ConfigurationManager::get_AppSettings() in
> > > assembly
> > >
> > >
>
> /usr/local/lib64/mono/gac/System.Configuration/4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll,
> > > referenced in assembly /usr/local/lib64/mono/4.0/System.Web.dll
> > > Missing method
> > > System.Configuration.ConfigurationManager::get_AppSettings() in
> > > assembly
> > >
> > >
>
> /usr/local/lib64/mono/gac/System.Configuration/4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll,
> > > referenced in assembly /usr/local/lib64/mono/4.0/System.Web.dll
> > > Missing method
> > >
> > >
>
> System.Configuration.ConfigurationProperty::.ctor(string,Type,object,TypeConverter,ConfigurationValidatorBase,ConfigurationPropertyOptions)
> > > in assembly
> > >
> > >
>
> /usr/local/lib64/mono/gac/System.Configuration/4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll,
> > > referenced in assembly /usr/local/lib64/mono/4.0/System.Web.dll
> > >
> > >
> > > ---------
> > > Fernando Rodriguez
> > > frodriguez.developer at outlook.com
> > > _______________________________________________
> > > Mono-list maillist - Mono-list at lists.ximian.com
> > > http://lists.ximian.com/mailman/listinfo/mono-list
> > >
>
> --
> ----------
> Fernando Rodriguez
> frodriguez.developer at outlook.com
> _______________________________________________
> Mono-list maillist - Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-list/attachments/20140916/0cc61d33/attachment-0001.html>
More information about the Mono-list
mailing list