【问题标题】:How do I _properly_ serve an XAP file from a self-hosted WCF service?如何_正确_从自托管 WCF 服务提供 XAP 文件?
【发布时间】:2011-06-12 13:40:02
【问题描述】:

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

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

【问题讨论】:

    标签: vb.net wcf streaming xap self-hosting


    【解决方案1】:

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

    【讨论】:

    • 谢谢,那么“加载屏幕”的本质是什么?只是下载进度?
    • 在加载 SL 页面时出现的“圆圈点”?是的,我认为这是一个下载进度指示器。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-05-05
    • 2011-11-07
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多