我自己有一个自托管的 WCF 服务器设置,它提供一个 clientaccesspolicy.xml 和一个 index.htm,它只是指向我的 xap(可通过 app.xap 访问)。
我目前通过以下代码为他们服务:
Public Function GetPolicy() As System.IO.Stream Implements IClientAccessPolicy.GetPolicy
WebOperationContext.Current.OutgoingResponse.ContentType = "application/xml"
Return New IO.MemoryStream(IO.File.ReadAllBytes("Server Files/ClientAccessPolicy.xml"))
End Function
Public Function GetIndex() As IO.Stream Implements ISilverlightServer.GetIndex
WebOperationContext.Current.OutgoingResponse.ContentType = "text/html"
Return New IO.MemoryStream(IO.File.ReadAllBytes("Server Files/index.htm"))
End Function
Public Function GetXap() As IO.Stream Implements ISilverlightServer.GetXap
WebOperationContext.Current.OutgoingResponse.ContentType = "application/x-silverlight-app"
Return New IO.MemoryStream(IO.File.ReadAllBytes("Server Files/app.xap"))
End Function
它有效,可以完成我所追求的工作。但是,我认为这不能正确地流式传输 xap,而且我知道它是流式传输类型。如果这不能正确流式传输,我应该如何流式传输?
(XAP 和 index.htm 文件通过的端点有一个 webHttpBinding 绑定)
是否正确流式传输?还是我应该做一些改变?