Xamarin中的ASP.NET MVC 3项目给出了System.UnauthorizedAccessException错误

时间:2013-12-11 07:13:14

标签: c# asp.net asp.net-mvc mono xamarin

我在Mac OS X(10.9)上运行Xamarin(4.0.10 build 5)。我创建了ASP.NET MVC 3项目。首次运行给出了Microsoft.AspNet.WebPages的错误。我在this文章之后解决了这个问题并修复了它。现在当我运行它时会出现另一个错误:

  

System.UnauthorizedAccessException 访问路径“/Library/Frameworks/Mono.framework/Versions/3.2.0/etc/mono/registry”   被拒绝。

     

堆栈追踪:

     System.IO.Directory.CreateDirectoriesInternal(System.String path)中的

  [0x00064] in   /private/tmp/source/bockbuild-xamarin/profiles/mono-mac-xamarin-no-pcl/build-root/mono-3.2.0/mcs/class/corlib/System.IO/Directory.cs:113 at System .IO.Directory.CreateDirectory(System.String path)[0x000a4]   在   /private/tmp/source/bockbuild-xamarin/profiles/mono-mac-xamarin-no-pcl/build-root/mono-3.2.0/mcs/class/corlib/System.IO/Directory.cs:80   在System.IO.DirectoryInfo.Create()[0x00000]中   /private/tmp/source/bockbuild-xamarin/profiles/mono-mac-xamarin-no-pcl/build-root/mono-3.2.0/mcs/class/corlib/System.IO/DirectoryInfo.cs:141   at(wrapper remoting-invoke-with-check)System.IO.DirectoryInfo:Create   ()在System.IO.Directory.CreateDirectoriesInternal(System.String   路径)[0x00039] in   /private/tmp/source/bockbuild-xamarin/profiles/mono-mac-xamarin-no-pcl/build-root/mono-3.2.0/mcs/class/corlib/System.IO/Directory.cs:98   在System.IO.Directory.CreateDirectory(System.String path)[0x000a4]   在   /private/tmp/source/bockbuild-xamarin/profiles/mono-mac-xamarin-no-pcl/build-root/mono-3.2.0/mcs/class/corlib/System.IO/Directory.cs:80   在Microsoft.Win32.KeyHandler..ctor(Microsoft.Win32.RegistryKey rkey,   System.String basedir,Boolean is_volatile)[0x0004a] in   /private/tmp/source/bockbuild-xamarin/profiles/mono-mac-xamarin-no-pcl/build-root/mono-3.2.0/mcs/class/corlib/Microsoft.Win32/UnixRegistryApi.cs:136

请帮我解决这个问题。

2 个答案:

答案 0 :(得分:4)

在运行Arch发行版的Linux计算机上,我进行了以下更改以使安全问题成为可能:

sudo mkdir /etc/mono/registry
sudo mkdir /etc/mono/registry/LocalMachine
sudo chmod g+rwx /etc/mono/registry/
sudo chmod g+rwx /etc/mono/registry/LocalMachine

答案 1 :(得分:3)

查看this blog post是否可以帮助您。

(解决方案的裂缝)

sudo mkdir /Library/Frameworks/Mono.framework/Versions/Current/etc/mono/registry
sudo chmod g+rwx /Library/Frameworks/Mono.framework/Versions/Current/etc/mono/registry