WebHttpBinding “HttpContext.Current” null WCF SharePoint October 20, 2016
Posted by juanpablo1manrique in SharePoint.Tags: SharePoint
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,
Pattaya Vacation
WebHttpBinding “HttpContext.Current” null WCF SharePoint | Letras y Números