繁体   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