我已經從源代碼(tarball)構建Mono 3.0.2,並且從最新的tarball和Github上的最新版本構建了XSP,但我無法使用.net 4.5運行一個相對簡單的asp.net應用程序,因爲它將web.config中的'targetFramework =「4.5」'視爲無效。構建應用程序並運行控制檯.net 4.5應用程序工作得很好。無法在Mono 3上的xsp上運行asp.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
[email protected]:~/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)
[email protected]:~/Downloads/xsp$
如果我從web.config中刪除targetFramework元素,那麼錯誤消失,但我只是得到一個404,所以沒有一個http模塊掛鉤了。
任何想法?我被告知xsp4應該可以正常工作,但是從我所看到的情況來看,它似乎沒有更新以處理4.5。
對於「從最新的tarball和最新的Github構建XSP」,你是什麼意思?無論你是從tarball構建還是從github構建,你都可以從github – knocte
和AFAIK構建壓縮包非常老,所以你應該從github構建 – knocte
非常簡單,我構建了兩個,都嘗試了兩個,都給出了同樣的問題。 –