jump to navigation

WebHttpBinding “HttpContext.Current” null WCF SharePoint October 20, 2016

Posted by juanpablo1manrique in SharePoint.
Tags:
trackback

Desafortunadamente WCF no soporta estado y en SharePoint todos los trucos posibles no funcionaron,

[ServiceContract(Namespace = “”)]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession)]
public class MiService : ServiceBase

Tambien intente.

string cookieHeader = WebOperationContext.Current.IncomingRequest.Headers[HttpRequestHeader.Cookie];
// Here you can see the OutgoingResponse Header has set the cookies.
Match match = Regex.Match(cookieHeader, @”^SessionID=(?.*)$”);
if (match.Success)
{

//YEAH!!! I get it; but nop, never passed this way,
throw new Exception(match.Groups[“SessionID”].Value);
}
else
{
WebOperationContext.Current.OutgoingResponse.Headers[HttpResponseHeader.SetCookie] = cookieHeader + “;” + string.Format(“SessionID={0}”, “MIDATOAGUARDAR”);
}

Y tampoco,

Si saben algo me cuentan

 

SOLUCION

Una solucion que encontre para este caso es la siguiente,

ObtenerObjeto de negocio -> enviarlo como entrada en todos los métodos siguientes.

Finalmente en la nueva programación FronEnd ya no utilizamos el aburrido ViewState, así que manejamos el estado nosotros mismos,

Comments»

1. Pattaya Vacation - March 11, 2017

Pattaya Vacation

WebHttpBinding “HttpContext.Current” null WCF SharePoint | Letras y Números


Leave a comment