1

我自己有一个自托管的 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 绑定)

是否正确流式传输?还是我应该做一些改变?

4

1 回答 1

2

很好,XAP 文件不需要流式传输到客户端。实际上,它需要首先完全下载(因此在客户端缓冲)才能启动 SL 应用程序,因此在这种情况下您无需担心流式传输。

于 2011-06-12T22:59:48.710 回答