2014-07-21 11 views
31

Po uruchomieniu mojej strony ASP.NET MVC 4 na mojej stacji roboczej Fedora 20 za pomocą xsp4 (z MonoDevelop lub bezpośrednio) otrzymuję następujący wyjątek:Dostęp do ścieżki "/ etc/mono/registry" jest zabroniony

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 

Sprawdziłem to i nie ma pliku registry lub folder w /etc/mono/. Nie mogę też znaleźć tego w żadnym podfolderze, jak mogę rozwiązać to pytanie?

biegnę Fedorę 20 z najnowszej 3.15.6 jądra

$ 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 

mam inny setup w Ubuntu 14.04 LTS i że działa, więc to może być coś z wersji mono, czy może ja "brakuje mi jakiejś biblioteki?

Odpowiedz

61

Okazuje się, że po prostu tworząc folder przy użyciu mkdir

sudo mkdir /etc/mono/registry

i ustawienie odpowiednich uprawnień za pomocą chmod

sudo chmod uog+rw /etc/mono/registry

załatwia sprawę.

Jednak nadal nie rozumiem, gdzie taki folder jest ukryty w Ubuntu i dlaczego nie trzeba go tam tworzyć, a także dlaczego nie jest tworzony automatycznie podczas instalacji.

+7

w moim przypadku, miałem zrobić 'sudo chmod UOG + RW/etc/mono/registry'. Dzięki za pomoc! –

+0

@peter - Próbuję utworzyć ten katalog, ale jest to odmowa uprawnień. Jednak jestem administratorem komputera. – xameeramir

+0

Czy uruchomiłeś polecenie jako sudo? – peter

1

Można ustawić MONO_REGISTRY_PATH pkt do katalogu, który można kontrolować:

bash mkdir my-registry MONO_REGISTRY_PATH=`pwd`/my-registry xsp4

Powiązane problemy