簡體   English   中英

Nancy自托管HttpListenerException:“參數不正確”

[英]Nancy self hosting HttpListenerException: “The parameter is incorrect”

我通過github安裝了NancyFX 0.23.2源,並在Windows 7 x64上使用VS2013 Pro進行了構建。 我可以構建良好,但是當我通過GenericFileRespose返回任何內容時,我得到:

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檢索到的Nancy二進制文件,我的輸出很好,但是我沒有Nancy的調試信息。

我啟動了Nancy自托管演示程序,它似乎運行良好,但如果我不能說出我的項目有什么不同之處,就會感到不滿意。 一切都是為“任何CPU”構建的。 Nancy使用目標.net 4.0客戶端配置文件Nancy.Hosting.Self目標構建為.net 4.0完整版,我的類庫和啟動NancyHost的控制台應用程序也是如此。

任何見識將不勝感激。

我最好回答這個問題,因為沒有人做過。

一定有些麻煩,例如,當我安裝Nancy.Serialization.JsonNet 0.23.2的源代碼時,它與我通過nuget獲得的Nancy 0.23.2一起工作,但不適用於來自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異常消失了。

因此,對我來說,解決方案是使用Nancy 0.23.1,但我仍然不知道為什么0.23.2無法正常工作。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM