无法在Mono 3上的xsp上运行asp.net 4.5应用程序

Ste*_*ins 8 asp.net mono xsp owin katana

我从源代码(tarball)构建了Mono 3.0.2,并使用最新的tarball和最新的Github构建了XSP,但是我无法使用.net 4.5运行一个相对简单的asp.net应用程序,因为它看到' web.config中的targetFramework ="4.5"'无效.构建应用程序,并运行控制台.net 4.5应用程序工作正常.

这是有问题的web.config:

<?xml version="1.0"?>

<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->

<configuration>
  <appSettings>
    <add key="owin:HandleAllRequests" value="true" />
    <add key="owin:SetCurrentDirectory" value="true" />
  </appSettings>

  <system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5" />
  </system.web>

</configuration>
Run Code Online (Sandbox Code Playgroud)

这是xsp4抛出的例外:

An exception has occurred while generating HttpException page:
System.NullReferenceException: Object reference not set to an instance of an object
  at System.Web.Util.HttpEncoder.GetCustomEncoderFromConfig () [0x00000] in <filename unknown>:0
  at System.Lazy`1[System.Web.Util.HttpEncoder].InitValue () [0x00000] in <filename unknown>:0

The actual exception which was being reported was:
System.Web.HttpException: Initial exception ---> System.Configuration.ConfigurationErrorsException: Error deserializing configuration section httpRuntime: Unrecognized attribute 'targetFramework'. (/home/srobbins/Projects/nancykatana/NancyKatana/Web.config line
1)
  at System.Configuration.ConfigurationSection.DeserializeSection (System.Xml.XmlReader reader) [0x00000] in <filename unknown>:0
  at System.Configuration.Configuration.GetSectionInstance (System.Configuration.SectionInfo config, Boolean createDefaultInstance) [0x00000] in <filename unknown>:0
  at System.Configuration.ConfigurationSectionCollection.get_Item (System.String name) [0x00000] in <filename unknown>:0
  at System.Configuration.Configuration.GetSection (System.String path) [0x00000] in <filename unknown>:0
  at System.Web.Configuration.WebConfigurationManager.GetSection (System.String sectionName, System.String path, System.Web.HttpContext context) [0x00000] in <filename unknown>:0
  at System.Web.Configuration.WebConfigurationManager.GetSection (System.String sectionName) [0x00000] in <filename unknown>:0
  at System.Web.HttpRuntime..cctor () [0x00000] in <filename unknown>:0
  --- End of inner exception stack trace ---
Run Code Online (Sandbox Code Playgroud)

以及有关版本/配置的一些信息:

xsp-2.11

  Build Environment
    Install prefix:          /usr/local
    Datadir:                 /usr/local/share
    Libdir:                  /usr/local/lib
    Build documentation:     yes
    Mono 2.0 compiler:       /usr/local/bin/gmcs
    Mono 4.0 compiler:       /usr/local/bin/dmcs
    Target frameworks:       .NET 2.0, .NET 4.0
    Build SQLite samples:    yes
srobbins@ubuntu-vm:~/Downloads/xsp$ /usr/local/bin/mono --version
Mono JIT compiler version 3.0.2 (tarball Tue Jan  8 08:23:06 GMT 2013)
Copyright (C) 2002-2012 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
        TLS:           __thread
        SIGSEGV:       altstack
        Notifications: epoll
        Architecture:  x86
        Disabled:      none
        Misc:          softdebug
        LLVM:          supported, not enabled.
        GC:            Included Boehm (with typed GC and Parallel Mark)
srobbins@ubuntu-vm:~/Downloads/xsp$
Run Code Online (Sandbox Code Playgroud)

如果我从web.config中删除了targetFramework元素,那么错误就会消失,但我只得到一个404,所以没有任何一个http模块被连接起来.

有任何想法吗?我被告知xsp4应该可以正常工作,但从我可以看到它似乎没有更新到完全处理4.5.

Ast*_*aar 5

尝试编辑该文件:

 vi /opt/mono/bin/xsp4
Run Code Online (Sandbox Code Playgroud)

(您的位置可能不同,因为您自己编译,您应该知道存储文件的位置)

在它改变线:

exec /opt/mono/bin/mono $MONO_OPTIONS "/opt/mono/lib/mono/4.0/xsp4.exe" "$@"
Run Code Online (Sandbox Code Playgroud)

有了这个:

exec /opt/mono/bin/mono $MONO_OPTIONS "/opt/mono/lib/mono/4.5/xsp4.exe" "$@"
Run Code Online (Sandbox Code Playgroud)

然后复制可执行文件:

cp /opt/mono/lib/mono/4.0/xsp4.exe /opt/mono/lib/mono/4.5/
Run Code Online (Sandbox Code Playgroud)

我希望Mono家伙将来能够让它变得更加流畅,所以我们不需要手动执行此操作,但对我来说这个手动解决方法是有效的!

再一次,我在CentOS下完成了这个,所以它在Ubuntu上可能有点不同.