¿Cómo puedo servir un archivo XAP de un servicio WCF autohospedado?
-
27-10-2019 - |
Pregunta
Tengo una configuración de servidor WCF autohospedada, que sirve a ClientAccessPolicy.xml y un index.htm que solo tiene puntos a mi XAP (accesible a través de App.xap).
Actualmente los estoy sirviendo a través del siguiente código:
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
Funciona, hace el trabajo que busco. Sin embargo, no creo que esto transmita el XAP correctamente, y sé que es un tipo de transmisión. Si esto no lo transmite correctamente, ¿cómo debo transmitirlo?
(El punto final que están llegando los archivos XAP e index.htm tienen un enlace webHTTPBINDING)
¿Se está transmitiendo correctamente? ¿O debería hacer algunos cambios?
Solución
Eso está bien, el archivo XAP no necesita ser transmitido al cliente. En realidad, debe ser el primero completamente Descargado (por lo tanto, en bufferado en el cliente) para que se inicie la aplicación SL, por lo que no debe preocuparse por la transmisión en este caso.