我正在研究一个使用Nancy在WPF应用程序中托管的小型项目。我希望能够远程下载大约8MB的PDF文件。我能够使下载工作,但在下载过程中,应用程序不会响应任何其他请求。有没有一种方法可以允许文件下载而不捆绑所有其他请求?自主主机南希应用程序中的文件下载
Public Class ManualsModule : Inherits NancyModule
Public Sub New()
MyBase.New("/Manuals")
Me.Get("/") = Function(p)
Dim model As New List(Of String) From {"electrical", "opmaint", "parts"}
Return View("Manuals", model)
End Function
Me.Get("/{name}") = Function(p)
Dim manualName = p.name
Dim fileResponse As New GenericFileResponse(String.Format("Content\Manuals\{0}.pdf", manualName))
Return fileResponse
End Function
End Sub
End Class
或者在C#
public class ManualsModule : NancyModule
{
public ManualsModule() : base("/Manuals")
{
this.Get("/") = p =>
{
List<string> model = new List<string> {
"electrical",
"opmaint",
"parts"
};
return View("Manuals", model);
};
this.Get("/{name}") = p =>
{
dynamic manualName = p.name;
GenericFileResponse fileResponse = new GenericFileResponse(string.Format("Content\\Manuals\\{0}.pdf", manualName));
return fileResponse;
};
}
}
这个问题可能是周转基金围绕最大消息尺寸神秘的配置 - 但如果自我主机是为你工作,这是一个更好的选择,反正海事组织:) –