Coded Container
Coded Container

Reputation: 863

Mono XSP4 and XSP errors differ? What went wrong?

I am currently running Ubuntu 14.04 with Digital Ocean and was interested in setting up Mono to work with some .NET code. I am currently new with .NET however, I thought it would be neat to have a server setup online where I could view my code. Not that seeing my changes live on my own computer is bad, but I want to find a place to deploy my projects. I am already paying for hosting and am not interested in spending more money for IIS, so I thought this could be a quick solution. I was told that XSP is useful for momentarily testing your web applications in the browser. XSP does not seem to be working properly for my Linux System. I need some help.

After installing the following packages, I have been publishing these projects locally before adding them through SFTP to my server in its own directory. This directory has been set up with a A record and has been configured using a virtual host file at the following location (/etc/apache2/sites-available).

The following packages were installed on my server:

  1. mono-complete
  2. mono-devel
  3. referenceassemblies-pcl

I have tried to add a MVC4 project to my server however, this has causes some errors on the server. I thought that if I installed OWIN this would fix this particular issue with this MVC4 web application however I still received errors. MVC3 created similar errors. Going into the directory folder and using the command "xsp" and "xsp4" return different errors.

Currently, running a clean web form with nothing added using .NET framework 4.0 results in the following errors:

**XSP:** System.TypeLoadException
Could not load type 'System.Web.UI.ScriptResourceDefinition' from assembly 'System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.<br/>
**Stack Trace**: at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 

**XSP 4:** System.ArgumentException
An item with the same key has already been added.<br/>
**Stack Trace:** at System.ThrowHelper.ThrowArgumentException (ExceptionResource resource) [0x00000] in <filename unknown>:0 
  at System.Collections.Generic.Dictionary`2[System.String,System.Web.Routing.RouteBase].Insert (System.String key, System.Web.Routing.RouteBase value, Boolean add) [0x00000] in <filename unknown>:0 
  at System.Collections.Generic.Dictionary`2[System.String,System.Web.Routing.RouteBase].Add (System.String key, System.Web.Routing.RouteBase value) [0x00000] in <filename unknown>:0 
  at System.Web.Routing.RouteCollection.Add (System.String name, System.Web.Routing.RouteBase item) [0x00000] in <filename unknown>:0 
  at Microsoft.AspNet.FriendlyUrls.RouteCollectionExtensions.EnableFriendlyUrls (System.Web.Routing.RouteCollection routes, Microsoft.AspNet.FriendlyUrls.FriendlyUrlSettings settings, Microsoft.AspNet.FriendlyUrls.Resolvers.IFriendlyUrlResolver[] resolvers) [0x00000] in <filename unknown>:0 
  at Microsoft.AspNet.FriendlyUrls.RouteCollectionExtensions.EnableFriendlyUrls (System.Web.Routing.RouteCollection routes, Microsoft.AspNet.FriendlyUrls.FriendlyUrlSettings settings) [0x00000] in <filename unknown>:0 
  at WebApplication2.RouteConfig.RegisterRoutes (System.Web.Routing.RouteCollection routes) [0x00000] in <filename unknown>:0 
  at WebApplication2.Global.Application_Start (System.Object sender, System.EventArgs e) [0x00000] in <filename unknown>:0 
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 

My theories on this include:

  1. Did not install everything needed for MONO
  2. Need to add another dependency
  3. Am launching this application the wrong way
  4. Somehow I need to make mono listen on a specific IP and/or port? (see below)
  5. I am missing a step
  6. I did not publish my project using Xamarin.

Furthermore, when I launch XSP or XSP4 my terminal tells me the following:

Listening on address: 0.0.0.0 <br/>
Root Directory: /var/www/ms <br/>
Listening on port: 8080 (non-secure)

Also, don't troll and tell me that I have not added enough information. Please be patient with me and ask me what information I can get for you in order to resolve this issue. I don't know everything about the .NET environment and am very new.

Upvotes: 0

Views: 557

Answers (1)

Lex Li
Lex Li

Reputation: 63123

That's very reasonable.

  • ASP.NET MVC requires .NET 4.0 and above (sometimes later becomes .NET 4.5), so running any such applications in XSP (.NET 2 based) must end with the exception you got, as XSP and .NET 2 compatible CLR in Mono won't be able to host them.
  • XSP4 and .NET 4 compatible CLR in Mono 3 (I assume you use the default Ubuntu repository to install Mono) was old and buggy to fully host such applications. Microsoft never tested their frameworks against Mono at that time and .NET Framework was not open source then.

If possible, you can do the following,

  1. Use Xamarin repository to install Mono 4 (4.0.1 is latest at writing), www.mono-project.com/download/#download-lin

  2. If Mono 4.0.1 still fails, you might try out .NET Core and ASP.NET 5. Microsoft open sources .NET Core and ASP.NET 5 with full Linux/OS X coverage, so that's going to be the momentum you rely on.

Upvotes: 1

Related Questions