2013-01-09 60 views
8

我已經從源代碼(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。

+0

對於「從最新的tarball和最新的Github構建XSP」,你是什麼意思?無論你是從tarball構建還是從github構建,你都可以從github – knocte

+0

和AFAIK構建壓縮包非常老,所以你應該從github構建 – knocte

+0

非常簡單,我構建了兩個,都嘗試了兩個,都給出了同樣的問題。 –

回答

5

嘗試和編輯文件:

vi /opt/mono/bin/xsp4 

(你的位置可能會有所不同,因爲你自己編譯它,你應該知道你在哪裏存儲的文件)

在它改線:

exec /opt/mono/bin/mono $MONO_OPTIONS "/opt/mono/lib/mono/4.0/xsp4.exe" "[email protected]" 

有了這個:

exec /opt/mono/bin/mono $MONO_OPTIONS "/opt/mono/lib/mono/4.5/xsp4.exe" "[email protected]" 

,然後複製可執行文件:

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

我希望單人做它一點點在未來更加流暢,所以我們不需要手動做到這一點,但對我來說本手冊變通辦法!

同樣,我在CentOS下這樣做,所以它在Ubuntu上可能會有點不同。

0

我遇到了與MVC 4和單聲道3相同的問題。最奇怪的是,這個錯誤突然出現。恢復我的更改沒有幫助。最終我最終刪除了我的解決方案文件夾並檢出了新版本。這必須刪除一些創建的文件。之後,一切都像以前一樣工作。

相關問題