Mono xsp4 file not found exception WebServer2 - mono

I am getting this error when trying to run xsp4 on Debian.
root#debian-x86:/opt# xsp
Handling exception type FileNotFoundException
Message is Could not load file or assembly 'Mono.WebServer2, Version=0.2.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756' or one of its dependencies. The system cannot find the file specified.
IsTerminating is set to True
System.IO.FileNotFoundException: Could not load file or assembly 'Mono.WebServer2, Version=0.2.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756' or one of its dependencies. The system cannot find the file specified.
File name: 'Mono.WebServer2, Version=0.2.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756'
at (wrapper xdomain-invoke) System.AppDomain:CreateInstanceAndUnwrap (string,string)
at (wrapper remoting-invoke-with-check) System.AppDomain:CreateInstanceAndUnwrap (string,string)
at System.Web.Hosting.ApplicationHost.CreateApplicationHost (System.Type hostType, System.String virtualDir, System.String physicalDir) [0x00000] in <filename unknown>:0
at Mono.WebServer.VPathToHost.CreateHost (Mono.WebServer.ApplicationServer server, Mono.WebServer.WebSource webSource) [0x00000] in <filename unknown>:0
at Mono.WebServer.XSP.Server.RealMain (System.String[] args, Boolean root, IApplicationHost ext_apphost, Boolean quiet) [0x00000] in <filename unknown>:0
at Mono.WebServer.XSP.Server.Main (System.String[] args) [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.IO.FileNotFoundException: Could not load file or assembly 'Mono.WebServer2, Version=0.2.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756' or one of its dependencies. The system cannot find the file specified.
File name: 'Mono.WebServer2, Version=0.2.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756'
at (wrapper xdomain-invoke) System.AppDomain:CreateInstanceAndUnwrap (string,string)
at (wrapper remoting-invoke-with-check) System.AppDomain:CreateInstanceAndUnwrap (string,string)
at System.Web.Hosting.ApplicationHost.CreateApplicationHost (System.Type hostType, System.String virtualDir, System.String physicalDir) [0x00000] in <filename unknown>:0
at Mono.WebServer.VPathToHost.CreateHost (Mono.WebServer.ApplicationServer server, Mono.WebServer.WebSource webSource) [0x00000] in <filename unknown>:0
at Mono.WebServer.XSP.Server.RealMain (System.String[] args, Boolean root, IApplicationHost ext_apphost, Boolean quiet) [0x00000] in <filename unknown>:0
at Mono.WebServer.XSP.Server.Main (System.String[] args) [0x00000] in <filename unknown>:0
I have mono 3.10.0 installed to /opt/mono-3.10.0 and I have xsp 3.0.11 installed to /opt/xsp-3.0.11
I added both those directories to my PATH:
/opt/mono-3.10.0/bin:/opt/xsp-3.0.11/bin
Doing a search of the file system shows the DLL is in the GAC (I believe?):
root#debian-x86:/opt# find /opt -name Mono.WebServer2.dll
/opt/xsp-3.0.11/lib/mono/2.0/Mono.WebServer2.dll
/opt/xsp-3.0.11/lib/mono/gac/Mono.WebServer2/0.2.0.0__0738eb9f132ed756/Mono.WebServer2.dll
/opt/xsp-3.0.11/lib/mono/gac/Mono.WebServer2/0.4.0.0__0738eb9f132ed756/Mono.WebServer2.dll
/opt/xsp-3.0.11/lib/mono/4.5/Mono.WebServer2.dll
I am completely new to both Linux and Mono so I am missing something here?
Do the lib paths have to go in some environment variable?

XSP needs to be installed in the same prefix as mono, not in a different one.

Related

Getting "Can't find custom atter constructor image" from a .dll after upgrading to Unity5

I've just upgraded to Unity5 and a small .dll I've made started to give the following error:
Unhandled Exception: System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.
at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (bool)
at System.Reflection.Assembly.GetTypes () [0x00000] in <filename unknown>:0
at Mono.CSharp.RootNamespace.ComputeNamespaces (System.Reflection.Assembly assembly, System.Type extensionType) [0x00000] in <filename unknown>:0
at Mono.CSharp.RootNamespace.ComputeNamespace (Mono.CSharp.CompilerContext ctx, System.Type extensionType) [0x00000] in <filename unknown>:0
at Mono.CSharp.GlobalRootNamespace.ComputeNamespaces (Mono.CSharp.CompilerContext ctx) [0x00000] in <filename unknown>:0
at Mono.CSharp.Driver.LoadReferences () [0x00000] in <filename unknown>:0
at Mono.CSharp.Driver.Compile () [0x00000] in <filename unknown>:0
at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in <filename unknown>:0
Missing method .ctor in assembly [myproj... .dll], type System.Runtime.Versioning.TargetFrameworkAttribute
The class System.Runtime.Versioning.TargetFrameworkAttribute could not be loaded, used in Logger
Can't find custom attr constructor image: [myproj... .dll]
mtoken: 0x0a00000e
​
The .dll worked perfectly before updating to Unity 5, and I did recompile the .dll with the unity5 version UnityEngine.dll (needed by my library), but that didn't help. Any ideas how to fix this?

Access to the path "/etc/mono/registry" is denied

When I run my ASP.NET MVC 4 website on my Fedora 20 workstation with xsp4 (from MonoDevelop or directly) I'm getting the following exception:
System.Web.HttpRuntime.FinishWithException (wr={Mono.WebServer.XSPWorkerRequest}, e={System.Web.HttpException: ---> System.Web.HttpException: The pre-application start initialization method Start on type System.Web.WebPages.PreApplicationStartCode threw an exception with the following error message: Exception has been thrown by the target of an invocation. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException: An exception was thrown by the type initializer for <Module> ---> System.Security.SecurityException: No access to the given key ---> System.UnauthorizedAccessException: Access to the path "/etc/mono/registry" is denied.
at System.IO.Directory.CreateDirectoriesInternal (System.String path) [0x00064] in /builddir/build/BUILD/mono-3.4.0/mcs/class/corlib/System.IO/Directory.cs:113
at System.IO.Directory.CreateDirectory (System.String path) [0x000a4] in /builddir/build/BUILD/mono-3.4.0/mcs/class/corlib/System.IO/Directory.cs:80
at System.IO.DirectoryInfo.Create () [0x00000] in /builddir/build/BUILD/mono-3.4.0/mcs/class/corlib/System.IO/DirectoryInfo.cs:141
at (wrapper remoting-invoke-with-check) System.IO.DirectoryInfo:Create ()
at System.IO.Directory.CreateDirectoriesInternal (System.String path) [0x00039] in /builddir/build/BUILD/mono-3.4.0/mcs/class/corlib/System.IO/Directory.cs:98
at System.IO.Directory.CreateDirectory (System.String path) [0x000a4] in /builddir/build/BUILD/mono-3.4.0/mcs/class/corlib/System.IO/Directory.cs:80
at Microsoft.Win32.KeyHandler..ctor (Microsoft.Win32.RegistryKey rkey, System.String basedir, Boolean is_volatile) [0x0004a] in /builddir/build/BUILD/mono-3.4.0/mcs/class/corlib/Microsoft.Win32/UnixRegistryApi.cs:136
--- End of inner exception stack trace ---
at Microsoft.Win32.KeyHandler..ctor (Microsoft.Win32.RegistryKey rkey, System.String basedir, Boolean is_volatile) [0x00057] in /builddir/build/BUILD/mono-3.4.0/mcs/class/corlib/Microsoft.Win32/UnixRegistryApi.cs:138
at Microsoft.Win32.KeyHandler..ctor (Microsoft.Win32.RegistryKey rkey, System.String basedir) [0x00000] in /builddir/build/BUILD/mono-3.4.0/mcs/class/corlib/Microsoft.Win32/UnixRegistryApi.cs:116
at Microsoft.Win32.KeyHandler.Lookup (Microsoft.Win32.RegistryKey rkey, Boolean createNonExisting) [0x000cc] in /builddir/build/BUILD/mono-3.4.0/mcs/class/corlib/Microsoft.Win32/UnixRegistryApi.cs:412
at Microsoft.Win32.UnixRegistryApi.OpenSubKey (Microsoft.Win32.RegistryKey rkey, System.String keyname, Boolean writable) [0x00000] in /builddir/build/BUILD/mono-3.4.0/mcs/class/corlib/Microsoft.Win32/UnixRegistryApi.cs:836
at Microsoft.Win32.RegistryKey.OpenSubKey (System.String name, Boolean writable) [0x0001e] in /builddir/build/BUILD/mono-3.4.0/mcs/class/corlib/Microsoft.Win32/RegistryKey.cs:278
at Microsoft.Win32.RegistryKey.OpenSubKey (System.String name) [0x00000] in /builddir/build/BUILD/mono-3.4.0/mcs/class/corlib/Microsoft.Win32/RegistryKey.cs:262
at (wrapper remoting-invoke-with-check) Microsoft.Win32.RegistryKey:OpenSubKey (string)
at Microsoft.Web.Infrastructure.RegistryKeyWrapper.OpenSubKey (System.String name) [0x00000] in <filename unknown>:0
at Microsoft.Web.Infrastructure.KillBitHelper.GetKillBittedVersions () [0x00000] in <filename unknown>:0
at Microsoft.Web.Infrastructure.KillBitHelper.IsThisAssemblyKillBitted () [0x00000] in <filename unknown>:0
at Microsoft.Web.Infrastructure.KillBitHelper.ThrowIfKillBitIsSet () [0x00000] in <filename unknown>:0
at Microsoft.Web.Infrastructure.ModuleInitializer+CriticalInitializer.CheckKillBit () [0x00000] in <filename unknown>:0
at Microsoft.Web.Infrastructure.ModuleInitializer+CriticalInitializer.Initialize () [0x00000] in <filename unknown>:0
at Microsoft.Web.Infrastructure.ModuleInitializer.Initialize () [0x00000] in <filename unknown>:0
at <Module>..cctor () [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Web.WebPages.PreApplicationStartCode.Start () [0x0002b] in /builddir/build/BUILD/mono-3.4.0/external/aspnetwebstack/src/System.Web.WebPages/PreApplicationStartCode.cs:40
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) [0x00054] in /builddir/build/BUILD/mono-3.4.0/mcs/class/corlib/System.Reflection/MonoMethod.cs:230
--- End of inner exception stack trace ---
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00069] in /builddir/build/BUILD/mono-3.4.0/mcs/class/corlib/System.Reflection/MonoMethod.cs:238
at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in /builddir/build/BUILD/mono-3.4.0/mcs/class/corlib/System.Reflection/MethodBase.cs:114
at System.Web.Compilation.BuildManager.CallPreStartMethods () [0x0004f] in /builddir/build/BUILD/mono-3.4.0/mcs/class/System.Web/System.Web.Compilation/BuildManager.cs:561
--- End of inner exception stack trace ---
at System.Web.Compilation.BuildManager.CallPreStartMethods () [0x0007e] in /builddir/build/BUILD/mono-3.4.0/mcs/class/System.Web/System.Web.Compilation/BuildManager.cs:564
at System.Web.HttpApplicationFactory.InitType (System.Web.HttpContext context) [0x00059] in /builddir/build/BUILD/mono-3.4.0/mcs/class/System.Web/System.Web/HttpApplicationFactory.cs:408
--- End of inner exception stack trace ---}) in /builddir/build/BUILD/mono-3.4.0/mcs/class/System.Web/System.Web/HttpRuntime.cs:674
I've checked it and there is no registry file or folder in /etc/mono/. I also can't find it in any subfolder, how can I resolve this question?
I'm running Fedora 20 with the latest 3.15.6 kernel
$ mono --version
Mono JIT compiler version 3.4.0 (tarball Fri Jun 27 17:26:36 UTC 2014)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS: __thread
SIGSEGV: altstack
Notifications: epoll
Architecture: amd64
Disabled: none
Misc: softdebug
LLVM: supported, not enabled.
GC: sgen
$ xsp4 --version
xsp4.exe 3.0.0.0
Copyright (C) 2002-2011 Novell, Inc.
Minimalistic web server for testing System.Web
I have another setup in Ubuntu 14.04 LTS and that one works, so it might be something with the mono version, or maybe I'm missing some library?
Turns out simply creating the folder using mkdir
sudo mkdir /etc/mono/registry
and setting the right permissions using chmod
sudo chmod uog+rw /etc/mono/registry
does the trick.
However I still don't understand where such a folder is hidden in Ubuntu and why it doesn't need to be created there, as well as why it isn't created automatically during the installation.
You can set MONO_REGISTRY_PATH to point to a directory that you control:
bash
mkdir my-registry
MONO_REGISTRY_PATH=`pwd`/my-registry
xsp4

How does one set the filename in Monodevelop?

I have recently installed MonoDevelop V3.0.3.2 on Linux Mint 15 MATE 64-bit.
I installed MonoDevelop through the Software Manager
I attempted to create a new project per http://monodevelop.com/Documentation/Creating_A_Simple_Solution
Unfortunately I receive an error on attempting to build that the filename has not been set. Details of error received are as follows.
System.InvalidOperationException: File name has not been set
at System.Diagnostics.Process.Start_common (System.Diagnostics.ProcessStartInfo startInfo, System.Diagnostics.Process process) [0x00000] in <filename unknown>:0
at System.Diagnostics.Process.Start () [0x00000] in <filename unknown>:0
at MonoDevelop.Core.Execution.ProcessWrapper.Start () [0x00000] in <filename unknown>:0
at (wrapper remoting-invoke-with-check) MonoDevelop.Core.Execution.ProcessWrapper:Start ()
at MonoDevelop.Platform.GnomePlatform.StartConsoleProcess (System.String command, System.String arguments, System.String workingDirectory, IDictionary`2 environmentVariables, System.String title, Boolean pauseWhenFinished) [0x00000] in <filename unknown>:0
at MonoDevelop.Core.Execution.ProcessService.StartConsoleProcess (System.String command, System.String arguments, System.String workingDirectory, IDictionary`2 environmentVariables, IConsole console, System.EventHandler exited) [0x00000] in <filename unknown>:0
at MonoDevelop.Debugger.Soft.SoftDebuggerEngine+<CreateDebuggerStartInfo>c__AnonStorey1.<>m__6 (System.Diagnostics.ProcessStartInfo info) [0x00000] in <filename unknown>:0
at Mono.Debugger.Soft.VirtualMachineManager.BeginLaunch (System.Diagnostics.ProcessStartInfo info, System.AsyncCallback callback, Mono.Debugger.Soft.LaunchOptions options) [0x00000] in <filename unknown>:0
at Mono.Debugging.Soft.SoftDebuggerSession.StartLaunching (Mono.Debugging.Soft.SoftDebuggerStartInfo dsi) [0x00000] in <filename unknown>:0 at Mono.Debugging.Soft.SoftDebuggerSession.OnRun (Mono.Debugging.Client.DebuggerStartInfo startInfo) [0x00000] in <filename unknown>:0
at Mono.Debugging.Client.DebuggerSession+<Run>c__AnonStorey6.<>m__3 () [0x00000] in <filename unknown>:0
How does one set the filename in Monodevelop?
EDIT: The Build of the project is working , Problem is occurring when attempting to run the application in the IDE
I had the same issue. I found out that if you install xterm, and restart monodevelop the error will be resolved. Apparently xterm is a dependency. Just go to terminal and "sudo apt-get install xterm".

Issues with installing Orchard & Mono

I am currently running an Ubuntu Server 12.10.
I tried to install Orchard along with mono. When i try to start mono :
MONO_IOMAP=all xsp4
I get the following errors in the CLI:
Handling exception type ConfigurationErrorsException
Message is No factory for host (/home/shto/sites/test/Orchard/Web.config line 13)
IsTerminating is set to True
System.Configuration.ConfigurationErrorsException: No factory for host (/home/shto/sites/test/Orchard/Web.config line 13)
Server stack trace:
at System.Configuration.ConfigInfo.ThrowException (System.String text, System.Xml.XmlReader reader) [0x00000] in <filename unknown>:0
at System.Configuration.SectionGroupInfo.ReadRemoveSection (System.Xml.XmlReader reader) [0x00000] in <filename unknown>:0
at System.Configuration.SectionGroupInfo.ReadConfig (System.Configuration.Configuration cfg, System.String streamName, System.Xml.XmlReader reader) [0x00000] in <filename unknown>:0
at System.Configuration.SectionGroupInfo.ReadConfig (System.Configuration.Configuration cfg, System.String streamName, System.Xml.XmlReader reader) [0x00000] in <filename unknown>:0
at System.Configuration.Configuration.ReadConfigFile (System.Xml.XmlReader reader, System.String fileName) [0x00000] in <filename unknown>:0
at System.Configuration.Configuration.Load () [0x00000] in <filename unknown>:0
at System.Configuration.Configuration.Init (IConfigSystem system, System.String configPath, System.Configuration.Configuration parent) [0x00000] in <filename unknown>:0
at System.Configuration.Configuration..ctor (System.Configuration.InternalConfigurationSystem system, System.String locationSubPath) [0x00000] in <filename unknown>:0
at System.Configuration.InternalConfigurationFactory.Create (System.Type typeConfigHost, System.Object[] hostInitConfigurationParams) [0x00000] in <filename unknown>:0
at System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration (System.String path, System.String site, System.String locationSubPath, System.String server, System.String userName, System.String password, Boolean fweb) [0x00000] in <filename unknown>:0
Exception rethrown at [0]:
at (wrapper xdomain-invoke) System.AppDomain:DoCallBack (System.CrossAppDomainDelegate)
at (wrapper remoting-invoke-with-check) System.AppDomain:DoCallBack (System.CrossAppDomainDelegate)
at System.Web.Hosting.ApplicationHost.CreateApplicationHost (System.Type hostType, System.String virtualDir, System.String physicalDir) [0x00000] in <filename unknown>:0
at Mono.WebServer.VPathToHost.CreateHost (Mono.WebServer.ApplicationServer server, Mono.WebServer.WebSource webSource) [0x00000] in <filename unknown>:0
at Mono.WebServer.XSP.Server.RealMain (System.String[] args, Boolean root, IApplicationHost ext_apphost, Boolean quiet) [0x00000] in <filename unknown>:0
at Mono.WebServer.XSP.Server.Main (System.String[] args) [0x00000] in <filename unknown>:0
When i installed mono i used the command: apt-get install mono-complete
Orchard currently does not run in Mono.

Embedded mono + app.config

I have embedded mono in a c++ program and loaded a dll which requires an app.config. I am getting this kind of error, does someone have an idea on how to ship *.config with an embedded mono ?
The stack trace :
System.Configuration.ConfigurationErrorsException: Error Initializing the configuration system. ---> System.ArgumentException: The 'ExeConfigFilename' argument cannot be null.
at System.Configuration.ExeConfigurationHost.CheckFileMap (ConfigurationUserLevel level, System.Configuration.ExeConfigurationFileMap map) [0x00000] in <filename unknown>:0
at System.Configuration.ExeConfigurationHost.InitForConfiguration (System.String& locationSubPath, System.String& configPath, System.String& locationConfigPath, IInternalConfigRoot root, System.Object[] hostInitConfigurationParams) [0x00000] in <filename unknown>:0
at System.C[] hostInitConfigurationParams) [0x00000] in <filename unknown>:0
at System.Configuration.ConfigurationManager.OpenExeConfigurationInternal (ConfigurationUserLevel userLevel, System.Reflection.Assembly calling_assembly, System.String exePath) [0x00000] in <filename unknown>:0
at System.Configuration.ClientConfigurationSystem.get_Configuration () [0x00000] in <filename unknown>:0 onfiguration.InternalConfigurationSystem.InitForConfiguration (System.String& locationConfigPath, System.String& parentConfigPath, System.String& parentLocationConfigPath) [0x00000] in <filename unknown>:0
at System.Configuration.Configuration..ctor (System.Configuration.InternalConfigurationSystem system, System.String locationSubPath) [0x00000] in <filename unknown>:0
at System.Configuration.InternalConfigurationFactory.Create (System.Type typeConfigHost, System.Object
Self answer : you can't (as of 2013-04-30). To enable this behaviour, I had to change mono's framework sources mono/mcs/class/corlib/system/appdomain.cs :
public AppDomainSetup SetupInformation {
get {
return SetupInformationNoCopy; // newline
// AppDomainSetup setup = getSetup (); //old
// return new AppDomainSetup (setup); //old
}
}