2014-10-04 98 views
0

我通過github安裝了NancyFX 0.23.2源代碼,並在Windows 7 x64上安裝了VS2013 Pro。我可以建立很好,但是當我通過GenericFileRespose返回什麼,我得到:Nancy自己託管HttpListenerException:「參數不正確」

A first chance exception of type 'System.Net.HttpListenerException' occurred in System.dll 
--- 
System.Net.HttpListenerException (0x80004005): The parameter is incorrect 
    at System.Net.HttpResponseStream.Write(Byte[] buffer, Int32 offset, Int32 size) 
    at System.IO.Stream.InternalCopyTo(Stream destination, Int32 bufferSize) 
    at Nancy.Responses.GenericFileResponse.<>c__DisplayClass1.<GetFileContent>b__0(Stream stream) in h:\home\projects\nancy\0.23.2\Nancy\src\Nancy\Responses\GenericFileResponse.cs:line 82 
    at Nancy.Hosting.Self.NancyHost.OutputWithDefaultTransferEncoding(Response nancyResponse, HttpListenerResponse response) in h:\home\projects\nancy\0.23.2\Nancy\src\Nancy.Hosting.Self\NancyHost.cs:line 320 
    at Nancy.Hosting.Self.NancyHost.ConvertNancyResponseToResponse(Response nancyResponse, 
... 

如果我鏈接,而是通過的NuGet檢索南希的二進制文件,我的輸出是不錯,但我有沒有調試信息南希。

我啓動了南希自己的主機演示程序,它似乎工作正常,但如果我能說出我的項目有什麼不同,就會跳動。一切都是爲「任何CPU」而構建的。 Nancy是用目標.net 4.0客戶端配置文件構建的,Nancy.Hosting.Self目標是.net 4.0完整版,我的類庫和我的控制檯應用程序啓動了NancyHost。

任何瞭解將不勝感激。

回答

0

我不如回答這個問題,因爲沒有人做過。

必須有點可疑,因爲當我爲Nancy.Serialization.JsonNet 0.23.2安裝源代碼時,它與Nancy 0.23.2一起工作我通過nuget獲得了,但不是來自github的Nancy 0.23.2源代碼。 JsonNetBodyDeserializer.Deserialize()引用BindingContext.ValidModelProperties,但在Nancy 0.23.2源代碼中不存在;它已被BindingContext.ValidModelBindingMembers(包含屬性和字段)所取代。

當我檢索,編譯和使用Nancy 0.23.1的源碼時,Nancy.Serialization.JsonNet很高興,並且我的System.Net.HttpListener異常消失了。

所以,我的解決方案是使用南希0.23.1,但我仍然不知道爲什麼0.23.2不起作用。