gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-02 18:15:31 25 4
gpt4 key购买 nike

我已经从源代码(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>

这是 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 ---

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

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$

如果我从 web.config 中删除 targetFramework 元素,那么错误就会消失,但我只得到 404,因此没有任何 http 模块被连接。

有什么想法吗?有人告诉我 xsp4 应该可以正常工作,但从我所看到的来看,它似乎根本没有更新为可以处理 4.5。

最佳答案

尝试编辑该文件:

 vi /opt/mono/bin/xsp4

(您的位置可能会有所不同,因为您自己编译了它,所以您应该知道文件存储在哪里)

在其中更改行:

exec /opt/mono/bin/mono $MONO_OPTIONS "/opt/mono/lib/mono/4.0/xsp4.exe" "$@"

这样:

exec /opt/mono/bin/mono $MONO_OPTIONS "/opt/mono/lib/mono/4.5/xsp4.exe" "$@"

然后复制可执行文件:

cp /opt/mono/lib/mono/4.0/xsp4.exe /opt/mono/lib/mono/4.5/

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

同样,我是在 CentOS 下完成此操作,因此在 Ubuntu 上可能会有所不同。

关于asp.net - 无法在 Mono 3 上的 xsp 上运行 asp.net 4.5 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14244779/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com