SharePoint WCF Service with HTTPS and Cert

%3CLINGO-SUB%20id%3D%22lingo-sub-991092%22%20slang%3D%22en-US%22%3ESharePoint%20WCF%20Service%20with%20HTTPS%20and%20Cert%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-991092%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20There%2C%3C%2FP%3E%3CP%3EI%20create%20a%20WCF%20for%20SharePoint%20with%20HTTPS%20and%20Cert.%20But%20I%20am%20still%20cannot%20connect%20to%20the%20WCF%20Service%20(in%20the%20ISAPI%20folder).%20I%20list%20out%20my%20sample%20code%20and%20web.config.%20how%20could%20I%20sort%20it%20out.%3F%3F%20do%20you%20have%20any%20idea%20on%20it%3F%20I%20got%20the%20error%20message%20%3A%3A%3C%2FP%3E%3CP%3EThanks%20for%20your%20help%3C%2FP%3E%3CP%3E%22%3C%2FP%3E%3CDIV%3E%3CSTRONG%3E%3CSPAN%3ESystem.ServiceModel.Security.SecurityNegotiationException%3CBR%20%2F%3E%26nbsp%3B%20HResult%3D0x80131500%3CBR%20%2F%3E%26nbsp%3B%20Message%3DCould%20not%20establish%20trust%20relationship%20for%20the%20SSL%2FTLS%20secure%20channel%20with%20authority%20'ext.litwareinc.pri'.%3CBR%20%2F%3E%26nbsp%3B%20Source%3D%3CCANNOT%20evaluate%3D%22%22%20the%3D%22%22%20exception%3D%22%22%20source%3D%22%22%3E%3CBR%20%2F%3E%26nbsp%3B%20StackTrace%3A%3CBR%20%2F%3E%3CCANNOT%20evaluate%3D%22%22%20the%3D%22%22%20exception%3D%22%22%20stack%3D%22%22%20trace%3D%22%22%3E%3C%2FCANNOT%3E%3C%2FCANNOT%3E%3C%2FSPAN%3E%3C%2FSTRONG%3E%3C%2FDIV%3E%3CDIV%3E%3CSTRONG%3E%3CSPAN%3EInner%20Exception%201%3A%3CBR%20%2F%3EHttpRequestException%3A%20The%20SSL%20connection%20could%20not%20be%20established%2C%20see%20inner%20exception.%3C%2FSPAN%3E%3C%2FSTRONG%3E%3C%2FDIV%3E%3CDIV%3E%3CSTRONG%3E%3CSPAN%3EInner%20Exception%202%3A%3CBR%20%2F%3EAuthenticationException%3A%20The%20remote%20certificate%20is%20invalid%20according%20to%20the%20validation%20procedure.%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FSTRONG%3E%3C%2FDIV%3E%3CP%3E%22%3C%2FP%3E%3CP%3E%3CSTRONG%3Eweb.config%3C%2FSTRONG%3E%3C%2FP%3E%3CPRE%3E%3CSPAN%20class%3D%22tag%22%3E%3CSYSTEM.SERVICEMODEL%3E%3C%2FSYSTEM.SERVICEMODEL%3E%3C%2FSPAN%3E%0A%20%20%20%20%3CSPAN%20class%3D%22tag%22%3E%3CBEHAVIORS%3E%3C%2FBEHAVIORS%3E%3C%2FSPAN%3E%0A%20%20%20%20%20%20%3CSPAN%20class%3D%22tag%22%3E%3CSERVICEBEHAVIORS%3E%3C%2FSERVICEBEHAVIORS%3E%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22tag%22%3E%3CBEHAVIOR%3E%3C%2FBEHAVIOR%3E%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22atn%22%3Ename%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22atv%22%3E%22MyServiceServiceBehavior%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22tag%22%3E%26gt%3B%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22tag%22%3E%3CSERVICEMETADATA%3E%3C%2FSERVICEMETADATA%3E%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22atn%22%3EhttpGetEnabled%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22atv%22%3E%22true%22%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22atn%22%3EhttpsGetEnabled%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22atv%22%3E%22true%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22tag%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%0A%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22tag%22%3E%3CSERVICEDEBUG%3E%3C%2FSERVICEDEBUG%3E%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22atn%22%3EincludeExceptionDetailInFaults%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22atv%22%3E%22true%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22tag%22%3E%26gt%3B%3C%2FSPAN%3E%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22tag%22%3E%3C%2FSPAN%3E%0A%20%20%20%20%20%20%3CSPAN%20class%3D%22tag%22%3E%3C%2FSPAN%3E%0A%20%20%20%20%20%20%3CSPAN%20class%3D%22tag%22%3E%3CENDPOINTBEHAVIORS%3E%3C%2FENDPOINTBEHAVIORS%3E%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22tag%22%3E%3CBEHAVIOR%3E%3C%2FBEHAVIOR%3E%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22atn%22%3Ename%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22atv%22%3E%22jsonBehaviour%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22tag%22%3E%26gt%3B%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22tag%22%3E%3CWEBHTTP%3E%3C%2FWEBHTTP%3E%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22tag%22%3E%2F%26gt%3B%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22tag%22%3E%3CCLIENTCREDENTIALS%3E%3C%2FCLIENTCREDENTIALS%3E%3C%2FSPAN%3E%20%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22tag%22%3E%3CSERVICECERTIFICATE%3E%3C%2FSERVICECERTIFICATE%3E%3C%2FSPAN%3E%20%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22tag%22%3E%3CAUTHENTICATION%3E%3C%2FAUTHENTICATION%3E%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22atn%22%3EcertificateValidationMode%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22atv%22%3E%22PeerOrChainTrust%22%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22tag%22%3E%2F%26gt%3B%3C%2FSPAN%3E%20%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22tag%22%3E%3C%2FSPAN%3E%20%20%0A%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22tag%22%3E%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22tag%22%3E%3C%2FSPAN%3E%20%20%20%0A%20%20%20%20%20%20%3CSPAN%20class%3D%22tag%22%3E%3C%2FSPAN%3E%0A%20%20%20%20%3CSPAN%20class%3D%22tag%22%3E%3C%2FSPAN%3E%0A%20%20%20%20%3CSPAN%20class%3D%22tag%22%3E%3CBINDINGS%3E%3C%2FBINDINGS%3E%3C%2FSPAN%3E%0A%20%20%20%20%20%20%3CSPAN%20class%3D%22tag%22%3E%3CWSHTTPBINDING%3E%3C%2FWSHTTPBINDING%3E%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22com%22%3E%3C!--%3Cbinding%20name%3D%22BasicHttpEndpointBinding%22%20maxBufferSize%3D%222147483647%22%20maxBufferPoolSize%3D%22524288%22%20maxReceivedMessageSize%3D%222147483647%22%3E%0A%20%20%20%20%20%20%20%20%3C%2Fbinding%3E--%3E%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22tag%22%3E%3CBINDING%3E%3C%2FBINDING%3E%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22atn%22%3Ename%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22atv%22%3E%22secureHttpBinding%22%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22atn%22%3EmaxBufferSize%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22atv%22%3E%222147483647%22%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22atn%22%3EmaxBufferPoolSize%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22atv%22%3E%22524288%22%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22atn%22%3EmaxReceivedMessageSize%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22atv%22%3E%222147483647%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22tag%22%3E%26gt%3B%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22com%22%3E%3C!--%3Csecurity%20mode%3D%22Transport%22%3E--%3E%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22com%22%3E%3C!--%3Ctransport%20clientCredentialType%3D%22None%22%2F%3E--%3E%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22com%22%3E%3C!--%3C%2Fsecurity%3E--%3E%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22tag%22%3E%3CSECURITY%3E%3C%2FSECURITY%3E%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22atn%22%3Emode%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22atv%22%3E%22Message%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22tag%22%3E%26gt%3B%3C%2FSPAN%3E%20%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22tag%22%3E%3CMESSAGE%3E%3C%2FMESSAGE%3E%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22atn%22%3EclientCredentialType%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22atv%22%3E%22UserName%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22tag%22%3E%2F%26gt%3B%3C%2FSPAN%3E%20%20%0A%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22tag%22%3E%3C%2FSPAN%3E%20%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22tag%22%3E%3C%2FSPAN%3E%0A%20%20%20%20%20%20%3CSPAN%20class%3D%22tag%22%3E%3C%2FSPAN%3E%0A%20%20%20%20%3CSPAN%20class%3D%22tag%22%3E%3C%2FSPAN%3E%0A%20%20%20%20%3CSPAN%20class%3D%22tag%22%3E%3CSERVICES%3E%3C%2FSERVICES%3E%3C%2FSPAN%3E%0A%20%20%20%20%20%20%3CSPAN%20class%3D%22tag%22%3E%3CSERVICE%3E%3C%2FSERVICE%3E%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22atn%22%3Ename%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22atv%22%3E%22wcfSPdocument.Actions%22%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22atn%22%3EbehaviorConfiguration%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22atv%22%3E%22MyServiceServiceBehavior%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22tag%22%3E%26gt%3B%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22com%22%3E%3C!--%3Cendpoint%20address%3D%22%22%20binding%3D%22basicHttpBinding%22%20bindingConfiguration%3D%22BasicHttpEndpointBinding%22%20contract%3D%22TecturaWsListItems.v2.IService%22%3E%0A%20%20%20%20%20%20%20%20%3C%2Fendpoint%3E--%3E%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22tag%22%3E%3CENDPOINT%3E%3C%2FENDPOINT%3E%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22atn%22%3Eaddress%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22atv%22%3E%22%22%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22atn%22%3Ebinding%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22atv%22%3E%22basicHttpBinding%22%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22atn%22%3EbindingConfiguration%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22atv%22%3E%22secureHttpBinding%22%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22atn%22%3Econtract%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22atv%22%3E%22wcfSPdocument.IActions%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22tag%22%3E%2F%26gt%3B%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22tag%22%3E%3CENDPOINT%3E%3C%2FENDPOINT%3E%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22atn%22%3Eaddress%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22atv%22%3E%22mex%22%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22atn%22%3Ebinding%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22atv%22%3E%22mexHttpsBinding%22%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22atn%22%3Econtract%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22atv%22%3E%22IMetadataExchange%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22tag%22%3E%26gt%3B%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22tag%22%3E%3C%2FSPAN%3E%0A%20%20%20%20%20%20%3CSPAN%20class%3D%22tag%22%3E%3C%2FSPAN%3E%0A%20%20%20%20%3CSPAN%20class%3D%22tag%22%3E%3C%2FSPAN%3E%0A%20%20%20%20%3CSPAN%20class%3D%22tag%22%3E%3CSERVICEHOSTINGENVIRONMENT%3E%3C%2FSERVICEHOSTINGENVIRONMENT%3E%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22atn%22%3EaspNetCompatibilityEnabled%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22atv%22%3E%22true%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22tag%22%3E%26gt%3B%3C%2FSPAN%3E%0A%20%20%20%20%3CSPAN%20class%3D%22tag%22%3E%3C%2FSPAN%3E%0A%20%20%3CSPAN%20class%3D%22tag%22%3E%3C%2FSPAN%3E%20%20%20%3CP%3E%3CSTRONG%3EConsole.cs%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3E%3CSPAN%20class%3D%22kwd%22%3Eusing%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22typ%22%3ESystem%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%3B%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22kwd%22%3Eusing%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22typ%22%3ESystem%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3EIO%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%3B%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22kwd%22%3Eusing%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22typ%22%3ESystem%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3ENet%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%3B%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22kwd%22%3Eusing%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22typ%22%3ESystem%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3ENet%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3ESecurity%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%3B%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22kwd%22%3Eusing%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22typ%22%3ESystem%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3ESecurity%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3ECryptography%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3EX509Certificates%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%3B%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22kwd%22%3Eusing%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22typ%22%3ESystem%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3EServiceModel%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%3B%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22kwd%22%3Eusing%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22typ%22%3ESystem%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3EServiceModel%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3ESecurity%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%3B%3C%2FSPAN%3E%0A%0A%3CSPAN%20class%3D%22kwd%22%3Enamespace%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20wcfSPdocument%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3Eclient%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%7B%3C%2FSPAN%3E%0A%20%20%20%20%3CSPAN%20class%3D%22kwd%22%3Eclass%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22typ%22%3EProgram%3C%2FSPAN%3E%0A%20%20%20%20%3CSPAN%20class%3D%22pun%22%3E%7B%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kwd%22%3Estatic%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kwd%22%3Evoid%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22typ%22%3EMain%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22kwd%22%3Estring%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%5B%5D%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20args%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E)%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22pun%22%3E%7B%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22typ%22%3EConsole%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3EWriteLine%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22str%22%3E%22Hello%20World!%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E)%3B%3C%2FSPAN%3E%0A%0A%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kwd%22%3Evar%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20myBinding%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kwd%22%3Enew%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22typ%22%3EWSHttpBinding%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E()%3B%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22com%22%3E%2F%2FmyBinding.Security.Mode%20%3D%20BasicHttpSecurityMode.TransportCredentialOnly%3B%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22com%22%3E%2F%2FmyBinding.Security.Transport.ClientCredentialType%20%3D%20HttpClientCredentialType.Ntlm%3B%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20%20%20%20%20%20%20%20%20%20%20%20myBinding%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3ESecurity%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3EMode%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22pun%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22typ%22%3ESecurityMode%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3EMessage%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%3B%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20%20%20%20%20%20%20%20%20%20%20%20myBinding%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3ESecurity%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3EMessage%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3EClientCredentialType%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22pun%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22typ%22%3EMessageCredentialType%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3ECertificate%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%3B%3C%2FSPAN%3E%0A%0A%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kwd%22%3Evar%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20myEndPoint%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kwd%22%3Enew%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22typ%22%3EEndpointAddress%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22str%22%3E%22https%3A%2F%2Fext.litwareinc.pri%2F_vti_bin%2FwcfSPdocument%2FActions.svc%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E)%3B%3C%2FSPAN%3E%0A%0A%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22com%22%3E%2F%2F%2F%20HTTP%20WCf%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22com%22%3E%2F%2F%2F%20%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22com%22%3E%2F%2FwcfSPdocument.ActionsClient%20client%20%3D%20new%20wcfSPdocument.ActionsClient(myBinding%2C%20myEndPoint)%3B%3C%2FSPAN%3E%0A%0A%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22com%22%3E%2F%2F%2F%20HTTPs%20WCF%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22com%22%3E%2F%2F%2F%20%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22typ%22%3EServiceClient%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3EActionsClient%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20actionsClient%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kwd%22%3Enew%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22typ%22%3EServiceClient%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3EActionsClient%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E()%3B%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22typ%22%3EServicePointManager%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3EServerCertificateValidationCallback%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22pun%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kwd%22%3Edelegate%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22pun%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22kwd%22%3Eobject%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20sender1%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%2C%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20X509Certificate%20certificate%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%2C%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20X509Chain%20chain%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%2C%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22typ%22%3ESslPolicyErrors%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20sslPolicyErrors%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E)%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22pun%22%3E%7B%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kwd%22%3Ebool%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20validationResult%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kwd%22%3Etrue%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%3B%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kwd%22%3Ereturn%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20validationResult%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%3B%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22pun%22%3E%7D%3B%3C%2FSPAN%3E%0A%0A%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22typ%22%3EServicePointManager%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3ESecurityProtocol%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22pun%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22typ%22%3ESecurityProtocolType%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3ETls%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22pun%22%3E%7C%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22typ%22%3ESecurityProtocolType%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3ETls11%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22pun%22%3E%7C%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22typ%22%3ESecurityProtocolType%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3ETls12%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%3B%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22typ%22%3EServicePointManager%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3EServerCertificateValidationCallback%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22pun%22%3E%2B%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kwd%22%3Enew%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22typ%22%3ERemoteCertificateValidationCallback%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3EcustomXertificateValidation%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E)%3B%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20%20%20%20%20actionsClient%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3EClientCredentials%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3EClientCertificate%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3ESetCertificate%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3EStoreLocation%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3ELocalMachine%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%2C%3C%2FSPAN%3E%0A%20%20%20%20%3CSPAN%20class%3D%22typ%22%3EStoreName%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3EMy%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%2C%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20%20%20%20X509FindType%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3EFindByThumbprint%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%2C%3C%2FSPAN%3E%0A%20%20%20%20%3CSPAN%20class%3D%22str%22%3E%226ca3a7298d961286bd34c0523bcdae3d0e119c2f%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E)%3B%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20%20%20%20%20%20%20%20%20%20%20%20actionsClient%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3EClientCredentials%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3EUserName%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3EUserName%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22pun%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22str%22%3E%22litwareinc%5C%5CAdministrator%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%3B%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20%20%20%20%20%20%20%20%20%20%20%20actionsClient%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3EClientCredentials%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3EUserName%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3EPassword%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22pun%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22str%22%3E%22pass%40word1%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%3B%3C%2FSPAN%3E%0A%0A%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22com%22%3E%2F%2FConsole.WriteLine(%22client.state%3A%20%22%20%2B%20client.State)%3B%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22typ%22%3EConsole%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3EWriteLine%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22str%22%3E%22actionsClient%20state%3A%20%22%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22pun%22%3E%2B%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20actionsClient%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3EState%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E)%3B%3C%2FSPAN%3E%0A%0A%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kwd%22%3Estring%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20filename%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22pun%22%3E%40%3C%2FSPAN%3E%3CSPAN%20class%3D%22str%22%3E%22C%3A%5CUsers%5CAdministrator%5CDesktop%5Cdocs%5Cdeliverables%5CDeliverable%20-%20HTC-Watermarkingand%20Server%20Side%20Viewing%20-%20Overview%20and%20Configuration.docx%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%3B%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22com%22%3E%2F%2Fstring%20filename%20%3D%20%40%22Z%3A%5Csharing%5Cdocs%5Cdisableloopback.txt%22%3B%3C%2FSPAN%3E%0A%0A%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kwd%22%3Eusing%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22pun%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3EFileStream%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20fs%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kwd%22%3Enew%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22typ%22%3EFileStream%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3Efilename%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%2C%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22typ%22%3EFileMode%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3EOpen%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%2C%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22typ%22%3EFileAccess%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3ERead%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E))%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22pun%22%3E%7B%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22com%22%3E%2F%2F%20Create%20a%20byte%20array%20of%20file%20stream%20length%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kwd%22%3Ebyte%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%5B%5D%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20bytes%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22typ%22%3ESystem%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3EIO%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3EFile%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3EReadAllBytes%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3Efilename%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E)%3B%3C%2FSPAN%3E%0A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22com%22%3E%2F%2FRead%20block%20of%20bytes%20from%20stream%20into%20the%20byte%20array%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20fs%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3ERead%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3Ebytes%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%2C%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22lit%22%3E0%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%2C%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22typ%22%3ESystem%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3EConvert%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3EToInt32%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3Efs%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3ELength%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E))%3B%3C%2FSPAN%3E%0A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22typ%22%3EServiceClient%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3EDocumentData%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20documentData%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kwd%22%3Enew%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22typ%22%3EServiceClient%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3EDocumentData%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E()%3B%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20documentData%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3Econtent%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20bytes%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%3B%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20documentData%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3Efilename%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22typ%22%3EPath%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3EGetFileName%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3Efilename%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E)%3B%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20actionsClient%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3EDemonstration%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3EdocumentData%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E)%3B%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22typ%22%3EConsole%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3EWriteLine%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22str%22%3E%22client.state%3A%20%22%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22pun%22%3E%2B%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20actionsClient%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3EState%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E)%3B%3C%2FSPAN%3E%0A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22typ%22%3EConsole%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3EWriteLine%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3EdocumentData%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3Efilename%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%2B%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22str%22%3E%22%20has%20been%20uploaded.%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E)%3B%3C%2FSPAN%3E%0A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22com%22%3E%2F%2FClose%20the%20File%20Stream%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20fs%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3EClose%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E()%3B%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22pun%22%3E%7D%3C%2FSPAN%3E%0A%0A%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22typ%22%3EConsole%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3EWriteLine%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22str%22%3E%22client.state%3A%20%22%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22pun%22%3E%2B%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20actionsClient%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3EState%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E)%3B%3C%2FSPAN%3E%0A%0A%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22typ%22%3EConsole%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3EReadKey%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E()%3B%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22pun%22%3E%7D%3C%2FSPAN%3E%0A%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kwd%22%3Eprivate%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kwd%22%3Estatic%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kwd%22%3Ebool%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20customXertificateValidation%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22kwd%22%3Eobject%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20sender%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%2C%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20X509Certificate%20cert%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%2C%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20X509Chain%20chain%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%2C%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22typ%22%3ESystem%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3ENet%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3ESecurity%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3ESslPolicyErrors%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20error%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E)%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22pun%22%3E%7B%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kwd%22%3Ereturn%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kwd%22%3Etrue%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%3B%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22pun%22%3E%7D%3C%2FSPAN%3E%0A%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22com%22%3E%2F%2F%2F%20%3CSUMMARY%3E%3C%2FSUMMARY%3E%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22com%22%3E%2F%2F%2F%20Check%20if%20the%20client%20is%20open%20and%20then%20close%20it.%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22com%22%3E%2F%2F%2F%20%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22com%22%3E%2F%2F%2F%20%3COBJECT%3E%3CPARAM%20name%3D%22client%22%20%2F%3EThe%20client%20to%20close%3C%2FOBJECT%3E%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kwd%22%3Epublic%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kwd%22%3Estatic%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kwd%22%3Evoid%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22typ%22%3ECloseService%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3EwcfSPdocument%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3EActionsClient%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20client%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E)%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22pun%22%3E%7B%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kwd%22%3Eif%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22pun%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3Eclient%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E!%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kwd%22%3Enull%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22pun%22%3E%26amp%3B%26amp%3B%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20client%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3EState%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22pun%22%3E%3D%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22typ%22%3ECommunicationState%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3EOpened%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20client%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3ECloseAsync%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E()%3B%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22pun%22%3E%7D%3C%2FSPAN%3E%0A%20%20%20%20%3CSPAN%20class%3D%22pun%22%3E%7D%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22pun%22%3E%7D%3C%2FSPAN%3E%3C%2FPRE%3E%3CLINGO-LABS%20id%3D%22lingo-labs-991092%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Frequent Contributor

Hi There,

I create a WCF for SharePoint with HTTPS and Cert. But I am still cannot connect to the WCF Service (in the ISAPI folder). I list out my sample code and web.config. how could I sort it out.?? do you have any idea on it? I got the error message ::

Thanks for your help

"

System.ServiceModel.Security.SecurityNegotiationException
  HResult=0x80131500
  Message=Could not establish trust relationship for the SSL/TLS secure channel with authority 'ext.litwareinc.pri'.
  Source=<Cannot evaluate the exception source>
  StackTrace:
<Cannot evaluate the exception stack trace>
Inner Exception 1:
HttpRequestException: The SSL connection could not be established, see inner exception.
Inner Exception 2:
AuthenticationException: The remote certificate is invalid according to the validation procedure.

"

web.config

<system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior name="MyServiceServiceBehavior">
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"></serviceMetadata>
          <serviceDebug includeExceptionDetailInFaults="true"></serviceDebug>      
        </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior name="jsonBehaviour">
          <webHttp />
          <clientCredentials>  
            <serviceCertificate>  
              <authentication certificateValidationMode="PeerOrChainTrust" />  
            </serviceCertificate>  
          </clientCredentials>
        </behavior>   
      </endpointBehaviors>
    </behaviors>
    <bindings>
      <wsHttpBinding>
        <!--<binding name="BasicHttpEndpointBinding" maxBufferSize="2147483647" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647">
        </binding>-->
        <binding name="secureHttpBinding" maxBufferSize="2147483647" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647">
          <!--<security mode="Transport">-->
            <!--<transport clientCredentialType="None"/>-->
          <!--</security>-->
          <security mode="Message">  
            <message clientCredentialType="UserName"/>  
          </security> 
        </binding>
      </wsHttpBinding>
    </bindings>
    <services>
      <service name="wcfSPdocument.Actions" behaviorConfiguration="MyServiceServiceBehavior">
        <!--<endpoint address="" binding="basicHttpBinding" bindingConfiguration="BasicHttpEndpointBinding" contract="TecturaWsListItems.v2.IService">
        </endpoint>-->
        <endpoint address=""
                  binding="basicHttpBinding"
                  bindingConfiguration="secureHttpBinding"
                  contract="wcfSPdocument.IActions"/>
        <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange">
        </endpoint>
      </service>
    </services>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true">
    </serviceHostingEnvironment>
  </system.serviceModel>   

Console.cs

 

using System;
using System.IO;
using System.Net;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
using System.ServiceModel;
using System.ServiceModel.Security;

namespace wcfSPdocument.client{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            var myBinding = new WSHttpBinding();
            //myBinding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly;
            //myBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Ntlm;            myBinding.Security.Mode = SecurityMode.Message;            myBinding.Security.Message.ClientCredentialType = MessageCredentialType.Certificate;

            var myEndPoint = new EndpointAddress("https://ext.litwareinc.pri/_vti_bin/wcfSPdocument/Actions.svc");

            /// HTTP WCf
            /// 
            //wcfSPdocument.ActionsClient client = new wcfSPdocument.ActionsClient(myBinding, myEndPoint);

            /// HTTPs WCF
            /// 
            ServiceClient.ActionsClient actionsClient = new ServiceClient.ActionsClient();
                 
            ServicePointManager.ServerCertificateValidationCallback = delegate (object sender1, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) {
                bool validationResult = true;
                return validationResult;
            };

            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
            ServicePointManager.ServerCertificateValidationCallback += new RemoteCertificateValidationCallback(customXertificateValidation);                        
            actionsClient.ClientCredentials.ClientCertificate.SetCertificate(StoreLocation.LocalMachine,
    StoreName.My,    X509FindType.FindByThumbprint,
    "6ca3a7298d961286bd34c0523bcdae3d0e119c2f");            actionsClient.ClientCredentials.UserName.UserName = "litwareinc\\Administrator";            actionsClient.ClientCredentials.UserName.Password = "pass@word1";

            //Console.WriteLine("client.state: " + client.State);
            Console.WriteLine("actionsClient state: " + actionsClient.State);

            string filename = @"C:\Users\Administrator\Desktop\docs\deliverables\Deliverable - HTC-Watermarkingand Server Side Viewing - Overview and Configuration.docx";
            //string filename = @"Z:\sharing\docs\disableloopback.txt";

            using (FileStream fs = new FileStream(filename, FileMode.Open, FileAccess.Read))
            {
                // Create a byte array of file stream length
                byte[] bytes = System.IO.File.ReadAllBytes(filename);

                //Read block of bytes from stream into the byte array                fs.Read(bytes, 0, System.Convert.ToInt32(fs.Length));

                ServiceClient.DocumentData documentData = new ServiceClient.DocumentData();                documentData.content = bytes;                documentData.filename = Path.GetFileName(filename);                actionsClient.Demonstration(documentData);
                Console.WriteLine("client.state: " + actionsClient.State);

                Console.WriteLine(documentData.filename + " has been uploaded.");

                //Close the File Stream                fs.Close();
            }

            Console.WriteLine("client.state: " + actionsClient.State);

            Console.ReadKey();
        }

        private static bool customXertificateValidation(object sender, X509Certificate cert, X509Chain chain, System.Net.Security.SslPolicyErrors error)
        {
            return true;
        }

        /// <summary>
        /// Check if the client is open and then close it.
        /// </summary>
        /// <param name="client">The client to close</param>
        public static void CloseService(wcfSPdocument.ActionsClient client)
        {
            if (client != null && client.State == CommunicationState.Opened)                client.CloseAsync();
        }
    }
}
0 Replies