0
我有一个写在vb.net的WCF,我想从中返回一个zip文件。现在我可以得到这个工作,但我不知道如何设置文件应该保存为的建议名称(默认为不带扩展名的操作名称)。当我保存文件,然后用.zip扩展名重命名时,它就是我期望的zip文件。如何设置从WCF返回的zip文件的名称
所以我想能够设置文件扩展名,我想我没有被文件名打扰。
这里是我的示例代码:
<WebGet(UriTemplate:="Export/", ResponseFormat:=WebMessageFormat.Xml, BodyStyle:=WebMessageBodyStyle.Bare)>
Public Function ModelVersionExport() As System.IO.Stream
WebOperationContext.Current.OutgoingResponse.ContentType = "application/octet-stream"
'then I call my code that creates the io.stream of the zip file (that works fine)
End Function
我想也许我可以设置在OutGoingResponse
的东西,但没有什么期待权。
秀'创建ZIP file' – Claudius
流的io.stream没有工作,我的问题是它保存的文件被称为“导出”,没有文件扩展名。 – sbarnby71