Client Certs for WCF consumer stops working after a while -
i having peculiar issue certs not working after while wcf client app connect soap 1.1 sap service. boggles me steps have take make certs work again. after installed certs on couple of load balanced servers, seems works fine. after few days, 1 of app/servers throws error.
the request aborted: not create ssl/tls secure channel.
when log on server using mmc , open cert (i not have reinstall it, open enough), web app works. @ wits end why might happening. appreciated.
below architecture/some code samples of how apps/web services set up
[mvc webapp]--[ load balancer ]-->(server 1, server 2)--> sap soap 1.0 web service
some configuration , code samples..
<system.servicemodel> <client> <endpoint address="https://somesapwebservice:8104/xisoapadapter/messageservlet?senderparty=&senderservice=bc_portal&receiverparty=&receiverservice=&interface=si_appformdata_out_sync&interfacenamespace=urn%3acominc.com%3aotc%3ai1053%3appform" behaviorconfiguration="securecert" binding="wshttpbinding" contract="somecontract_out_sync" name="https_port" /> </client> <bindings> <wshttpbinding> <binding> <security mode="transport"> <transport clientcredentialtype="certificate" /> </security> </binding> </wshttpbinding> </bindings> <behaviors> <endpointbehaviors> <behavior name="securecert"> <clientcredentials> <clientcertificate storename="my" storelocation="currentuser" x509findtype="findbysubjectdistinguishedname" findvalue="cn=cnn, ou=windows, ou=sap, ou=service accounts, ou=admin, ou=corp, dc=myinc, dc=ds" /> </clientcredentials> </behavior> </endpointbehaviors> </behaviors> </system.servicemodel> .. <appsettings> <add key="protocolexceptionmessage" value="the content type text/xml; charset=utf-8 of response message not match content type of binding (application/soap+xml; charset=utf-8)" />
c# code
public actionresult formsubmit(submitviewmodel model) try { this.submittosapservice(model); return this.redirecttoaction("index", "complete"); } catch (protocolexception pe) { // current sap support soap 1.1 , wcf .net 4.6 runs on soap 1.2 - catching known exception // creating custom wcf binding handle possibility config convoluted var messagesnippet = configurationmanager.appsettings["protocolexceptionmessage"]; if (pe.message.contains(messagesnippet)) { return this.redirecttoaction("index", "complete"); } throw pe; }
one thing doing little off here told sap running saop 1.1 , .net running soap 1.2. getting protocol exception. around check text , if exception message matches expected, bypass it.
public string submittosapservice(submitviewmodel model) { var dtformdatarecords = new dt_formdata(); dtformdatarecords.records = new dt_formdatarecords(); dtformdatarecords.records.name = model.name .... var client = new si_appformdata_out_syncclient(); try { client.si_appformdata_out_sync(dtformdatarecords); } { client.close(); } ...
after trying run intellitrace on app, let clue me in app-pool settings load user profile set false. had cause issue getting. after set true, issue resolved.
Comments
Post a Comment