tag:blogger.com,1999:blog-76384932024-03-13T23:31:16.423-07:00Ritesh KesharwaniMy personal work experienceRitesh_Kesharwanihttp://www.blogger.com/profile/06191918659869264896noreply@blogger.comBlogger250125tag:blogger.com,1999:blog-7638493.post-30544972150628441572023-03-14T17:30:00.000-07:002023-03-14T17:30:14.622-07:00Create PFX file from Root files Key/PFX <p>If you have Root.key and Root.pfx file and you would like to create new PFX file, below is the solution.</p><p>I have used. </p><p></p><ol style="text-align: left;"><li>.NET Core 6.0 with Visual Studio 2022 Ver 17.4.3</li><li>"Portable.BouncyCastle" Version 1.9.0 from Nuget </li><li>"Microsoft.Extensions.Configuration" Version 7.0.0 from Nuget</li></ol><p></p><p><b>Here the working solution, use in your class and use it </b></p><p></p><p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: blue; font-family: "Cascadia Mono"; font-size: 9.5pt;">using</span><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"> Org.BouncyCastle.Asn1;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: blue; font-family: "Cascadia Mono"; font-size: 9.5pt;">using</span><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"> Org.BouncyCastle.Asn1.Pkcs;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: blue; font-family: "Cascadia Mono"; font-size: 9.5pt;">using</span><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"> Org.BouncyCastle.Asn1.X509;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: blue; font-family: "Cascadia Mono"; font-size: 9.5pt;">using</span><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"> Org.BouncyCastle.Crypto;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: blue; font-family: "Cascadia Mono"; font-size: 9.5pt;">using</span><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"> Org.BouncyCastle.Crypto.Generators;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: blue; font-family: "Cascadia Mono"; font-size: 9.5pt;">using</span><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"> Org.BouncyCastle.Crypto.Parameters;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: blue; font-family: "Cascadia Mono"; font-size: 9.5pt;">using</span><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"> Org.BouncyCastle.Crypto.Prng;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: blue; font-family: "Cascadia Mono"; font-size: 9.5pt;">using</span><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"> Org.BouncyCastle.Math;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: blue; font-family: "Cascadia Mono"; font-size: 9.5pt;">using</span><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"> Org.BouncyCastle.Pkcs;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: blue; font-family: "Cascadia Mono"; font-size: 9.5pt;">using</span><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"> Org.BouncyCastle.Security;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: blue; font-family: "Cascadia Mono"; font-size: 9.5pt;">using</span><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"> Org.BouncyCastle.Utilities;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: blue; font-family: "Cascadia Mono"; font-size: 9.5pt;">using</span><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"> Org.BouncyCastle.X509;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: blue; font-family: "Cascadia Mono"; font-size: 9.5pt;">using</span><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"> System.Security.Cryptography.X509Certificates;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: blue; font-family: "Cascadia Mono"; font-size: 9.5pt;"><o:p> </o:p></span><span style="color: blue; font-family: "Cascadia Mono"; font-size: 9.5pt;">public</span><span style="font-family: "Cascadia Mono"; font-size: 9.5pt;"> </span><span style="color: blue; font-family: "Cascadia Mono"; font-size: 9.5pt;">void</span><span style="font-family: "Cascadia Mono"; font-size: 9.5pt;"> <b>CreateSelfSignedPFXFile</b>()</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><span style="mso-spacerun: yes;"> </span>{<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: blue; font-family: "Cascadia Mono"; font-size: 9.5pt;"><span> </span>string</span><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;">
RootKeyFilePath = </span><span style="color: maroon; font-family: "Cascadia Mono"; font-size: 9.5pt;">@"C:\Test\RootFile.key"</span><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;">;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><span style="mso-spacerun: yes;"> </span></span><span style="color: blue; font-family: "Cascadia Mono"; font-size: 9.5pt;">string</span><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;">
RootPfxFilePath = </span><span style="color: maroon; font-family: "Cascadia Mono"; font-size: 9.5pt;">@"C:\Test\RootFile.pfx"</span><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;">;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><span style="mso-spacerun: yes;"> </span></span><span style="color: blue; font-family: "Cascadia Mono"; font-size: 9.5pt;">string</span><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"> pass = </span><span style="color: #a31515; font-family: "Cascadia Mono"; font-size: 9.5pt;">"Pass123#"</span><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;">;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><o:p> <span> </span></o:p></span><span style="color: green; font-family: "Cascadia Mono"; font-size: 9.5pt;">//Need file
name to have all certificate export into this file</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><span style="mso-spacerun: yes;"> </span></span><span style="color: blue; font-family: "Cascadia Mono"; font-size: 9.5pt;">string</span><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"> newPFXFileName
= </span><span style="color: maroon; font-family: "Cascadia Mono"; font-size: 9.5pt;">@"C:\Test\NewCertificate.pfx"</span><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;">;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><o:p> <span> </span></o:p></span><span style="font-family: "Cascadia Mono"; font-size: 9.5pt;">System.Security.Cryptography.X509Certificates.X509Certificate2
certificate = </span><span style="color: blue; font-family: "Cascadia Mono"; font-size: 9.5pt;">new </span><span style="font-family: "Cascadia Mono"; font-size: 9.5pt;">System.Security.Cryptography.X509Certificates.X509Certificate2(RootPfxFilePath,pass, X509KeyStorageFlags.MachineKeySet | X509KeyStorageFlags.PersistKeySet |X509KeyStorageFlags.Exportable);</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: blue; font-family: "Cascadia Mono"; font-size: 9.5pt;"><span> </span>string</span><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"> subject = </span><span style="color: #a31515; font-family: "Cascadia Mono"; font-size: 9.5pt;">"E=test@test.com,
CN=Test Name, OU=ORG, O=LSGS, L=Orlando, ST=MN,C=US"</span><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;">;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><span style="mso-spacerun: yes;"> </span></span><span style="color: blue; font-family: "Cascadia Mono"; font-size: 9.5pt;">try</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><span style="mso-spacerun: yes;"> </span>{<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><span style="mso-spacerun: yes;"> </span></span><span style="color: blue; font-family: "Cascadia Mono"; font-size: 9.5pt;">using</span><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"> </span><span style="color: blue; font-family: "Cascadia Mono"; font-size: 9.5pt;">var</span><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"> reader =
File.OpenText(RootKeyFilePath);<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><span style="mso-spacerun: yes;"> </span>AsymmetricKeyParameter? myCAprivateKey
= ((AsymmetricCipherKeyPair)</span><span style="color: blue; font-family: "Cascadia Mono"; font-size: 9.5pt;">new</span><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;">
<span> </span><span> </span><span> </span><span> </span>Org.BouncyCastle.OpenSsl.PemReader(reader).ReadObject())?.Private;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><o:p> <span> </span></o:p></span><span style="color: green; font-family: "Cascadia Mono"; font-size: 9.5pt;">//Create the
cert based on the CA cert privateKey and have new subject</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><span style="mso-spacerun: yes;"> <span> </span></span>X509Certificate2
MyCert = GenerateSelfSignedCertificate(subject, <span> <span> </span><span> </span><span> </span><span> <span> </span></span></span>certificate.Issuer.Replace(</span><span style="color: #a31515; font-family: "Cascadia Mono"; font-size: 9.5pt;">"S="</span><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;">,</span><span style="color: #a31515; font-family: "Cascadia Mono"; font-size: 9.5pt;">"ST="</span><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;">),
myCAprivateKey, pass);<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><o:p> <span> </span></o:p></span><span style="color: green; font-family: "Cascadia Mono"; font-size: 9.5pt;">//Export as pfx
with privatekey</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><span style="mso-spacerun: yes;"> </span></span><span style="color: blue; font-family: "Cascadia Mono"; font-size: 9.5pt;">byte</span><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;">[] certData =
MyCert.Export(X509ContentType.Pfx, pass);<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><span> </span>File.WriteAllBytes(newPFXFileName,
certData);<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><span style="mso-spacerun: yes;"> </span>}<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><span style="mso-spacerun: yes;"> </span></span><span style="color: blue; font-family: "Cascadia Mono"; font-size: 9.5pt;">catch</span><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"> (Exception
exc)</span><span style="font-family: "Cascadia Mono"; font-size: 9.5pt;">{</span><span style="font-family: "Cascadia Mono"; font-size: 9.5pt;">Console.WriteLine(exc.Message);</span><span style="font-family: "Cascadia Mono"; font-size: 9.5pt;">}</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><o:p> </o:p></span><span style="font-family: "Cascadia Mono"; font-size: 9.5pt;"> </span><span style="font-family: "Cascadia Mono"; font-size: 9.5pt;">}</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><span style="mso-spacerun: yes;"> <span> </span></span></span><span style="color: blue; font-family: "Cascadia Mono"; font-size: 9.5pt;">public</span><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;">
X509Certificate2 GenerateSelfSignedCertificate(</span><span style="color: blue; font-family: "Cascadia Mono"; font-size: 9.5pt;">string</span><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"> subjectName, </span><span style="color: blue; font-family: "Cascadia Mono"; font-size: 9.5pt;">string </span><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;">issuerName,
AsymmetricKeyParameter? issuerPrivKey, </span><span style="color: blue; font-family: "Cascadia Mono"; font-size: 9.5pt;">string</span><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"> pass)<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><span style="mso-spacerun: yes;"> <span> </span></span>{<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><span style="mso-spacerun: yes;"> <span> </span></span></span><span style="color: blue; font-family: "Cascadia Mono"; font-size: 9.5pt;">const</span><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"> </span><span style="color: blue; font-family: "Cascadia Mono"; font-size: 9.5pt;">int</span><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"> keyStrength =
2048;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><o:p> <span> </span></o:p></span><span style="color: green; font-family: "Cascadia Mono"; font-size: 9.5pt;">// Generating
Random Numbers</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><span style="mso-spacerun: yes;"> <span> </span></span>CryptoApiRandomGenerator
randomGenerator = </span><span style="color: blue; font-family: "Cascadia Mono"; font-size: 9.5pt;">new</span><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"> CryptoApiRandomGenerator();<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><span style="mso-spacerun: yes;"> <span> </span></span>SecureRandom
random = </span><span style="color: blue; font-family: "Cascadia Mono"; font-size: 9.5pt;">new</span><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"> SecureRandom(randomGenerator);<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><o:p> <span> </span></o:p></span><span style="color: green; font-family: "Cascadia Mono"; font-size: 9.5pt;">// The
Certificate Generator</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><span style="mso-spacerun: yes;"> <span> </span></span>X509V3CertificateGenerator certificateGenerator = </span><span style="color: blue; font-family: "Cascadia Mono"; font-size: 9.5pt;">new</span><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;">
X509V3CertificateGenerator();<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><o:p> <span> </span></o:p></span><span style="color: green; font-family: "Cascadia Mono"; font-size: 9.5pt;">// Serial
Number</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><span style="mso-spacerun: yes;"> <span> </span></span>BigInteger
serialNumber = BigIntegers.CreateRandomInRange(BigInteger.One,<span> </span>
<span> </span><span> </span><span> </span>BigInteger.ValueOf(Int64.MaxValue), random);<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><span> </span><span> </span>certificateGenerator.SetSerialNumber(serialNumber);<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: green; font-family: "Cascadia Mono"; font-size: 9.5pt;"><span> </span>// Signature
Algorithm</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: blue; font-family: "Cascadia Mono"; font-size: 9.5pt;"><span> </span>const</span><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"> </span><span style="color: blue; font-family: "Cascadia Mono"; font-size: 9.5pt;">string</span><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;">
signatureAlgorithm = </span><span style="color: #a31515; font-family: "Cascadia Mono"; font-size: 9.5pt;">"SHA256WithRSA"</span><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;">;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><span> </span>certificateGenerator.SetSignatureAlgorithm(signatureAlgorithm);<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: green; font-family: "Cascadia Mono"; font-size: 9.5pt;"><span> </span>// Issuer and
Subject Name</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><span> </span>X509Name
subjectDN = </span><span style="color: blue; font-family: "Cascadia Mono"; font-size: 9.5pt;">new</span><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"> X509Name(subjectName);<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><span> </span>X509Name
issuerDN = </span><span style="color: blue; font-family: "Cascadia Mono"; font-size: 9.5pt;">new</span><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"> X509Name(issuerName);<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><span> </span>certificateGenerator.SetIssuerDN(issuerDN);<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><span> </span>certificateGenerator.SetSubjectDN(subjectDN);<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: green; font-family: "Cascadia Mono"; font-size: 9.5pt;"><span> </span>// Valid For</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><span> </span>DateTime
notBefore = DateTime.UtcNow.Date;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><span> </span>DateTime
notAfter = notBefore.AddYears(10);<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="font-family: "Cascadia Mono"; font-size: 9.5pt;"><span> </span>certificateGenerator.SetNotBefore(notBefore);</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><span> </span>certificateGenerator.SetNotAfter(notAfter);<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: green; font-family: "Cascadia Mono"; font-size: 9.5pt;"><span> </span>// Subject
Public Key</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><span> </span>AsymmetricCipherKeyPair subjectKeyPair;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: blue; font-family: "Cascadia Mono"; font-size: 9.5pt;"><span> </span>var</span><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;">
keyGenerationParameters = </span><span style="color: blue; font-family: "Cascadia Mono"; font-size: 9.5pt;">new</span><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"> KeyGenerationParameters(random, keyStrength);<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: blue; font-family: "Cascadia Mono"; font-size: 9.5pt;"><span> </span>var</span><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;">
keyPairGenerator = </span><span style="color: blue; font-family: "Cascadia Mono"; font-size: 9.5pt;">new</span><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"> RsaKeyPairGenerator();<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><span> </span>keyPairGenerator.Init(keyGenerationParameters);<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><span> </span>subjectKeyPair =
keyPairGenerator.GenerateKeyPair();<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="font-family: "Cascadia Mono"; font-size: 9.5pt;"><span> </span>certificateGenerator.SetPublicKey(subjectKeyPair.Public);</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: green; font-family: "Cascadia Mono"; font-size: 9.5pt;"><span> </span>// Generating
the Certificate</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><span> </span>AsymmetricCipherKeyPair issuerKeyPair = subjectKeyPair;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: green; font-family: "Cascadia Mono"; font-size: 9.5pt;"><span> </span>// selfsign
certificate</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><span> </span>Org.BouncyCastle.X509.X509Certificate
certificate = certificateGenerator.Generate(issuerPrivKey, random);<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: green; font-family: "Cascadia Mono"; font-size: 9.5pt;"><span> </span>//
correcponding private key</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><span> </span>PrivateKeyInfo
info = PrivateKeyInfoFactory.CreatePrivateKeyInfo(subjectKeyPair.Private);<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: green; font-family: "Cascadia Mono"; font-size: 9.5pt;">// merge into
X509Certificate2</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><span> </span>X509Certificate2
x509 = </span><span style="color: blue; font-family: "Cascadia Mono"; font-size: 9.5pt;">new</span><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;">
<span> <span> </span></span>System.Security.Cryptography.X509Certificates.X509Certificate2(certificate.GetEncoded(),<span> </span>pass,
X509KeyStorageFlags.MachineKeySet | X509KeyStorageFlags.PersistKeySet |
<span> </span>X509KeyStorageFlags.Exportable);<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><o:p> <span> </span></o:p></span><span style="color: green; font-family: "Cascadia Mono"; font-size: 9.5pt;">//below does
not work for Window</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><span style="mso-spacerun: yes;"> <span> </span></span></span><span style="color: green; font-family: "Cascadia Mono"; font-size: 9.5pt;">//Asn1Sequence
seq =(Asn1Sequence)Asn1Object.FromStream(info.PrivateKeyData.GetDerEncoded());</span><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><o:p> <span> </span></o:p></span><span style="color: green; font-family: "Cascadia Mono"; font-size: 9.5pt;">//use this one</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><span style="mso-spacerun: yes;"> <span> </span></span>Asn1Sequence seq
=(Asn1Sequence)Asn1Object.FromStream(info.PrivateKeyData.GetOctetStream());<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><o:p> <span> </span></o:p></span><span style="color: blue; font-family: "Cascadia Mono"; font-size: 9.5pt;">if</span><span style="font-family: "Cascadia Mono"; font-size: 9.5pt;"> (seq.Count !=
9)</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><span style="mso-spacerun: yes;"> <span> </span></span>{<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><span style="mso-spacerun: yes;"> <span> </span></span></span><span style="color: green; font-family: "Cascadia Mono"; font-size: 9.5pt;">//throw new
PemException("malformed sequence in RSA private key");</span><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><span style="mso-spacerun: yes;"> <span> </span></span>}<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><o:p> <span> </span></o:p></span><span style="color: green; font-family: "Cascadia Mono"; font-size: 9.5pt;">//Create the Private Key</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><span style="mso-spacerun: yes;"><span> </span> </span>RsaPrivateKeyStructure rsa = </span><span style="color: blue; font-family: "Cascadia Mono"; font-size: 9.5pt;">new</span><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"> RsaPrivateKeyStructure(seq);<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><span style="mso-spacerun: yes;"><span> </span> </span>RsaPrivateCrtKeyParameters rsaparams = </span><span style="color: blue; font-family: "Cascadia Mono"; font-size: 9.5pt;">new</span><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"> RsaPrivateCrtKeyParameters(<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><span style="mso-spacerun: yes;"><span> </span> </span>rsa.Modulus,
rsa.PublicExponent, rsa.PrivateExponent, rsa.Prime1, rsa.Prime2, rsa.Exponent1,
rsa.Exponent2, rsa.Coefficient);<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><o:p> <span> </span></o:p></span><span style="color: green; font-family: "Cascadia Mono"; font-size: 9.5pt;">//below does
not work for Window</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><span style="mso-spacerun: yes;"> <span> </span></span></span><span style="color: green; font-family: "Cascadia Mono"; font-size: 9.5pt;">//x509.PrivateKey
= DotNetUtilities.ToRSA(rsaparams);</span><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: green; font-family: "Cascadia Mono"; font-size: 12.6667px;"><span> </span>//use this one</span><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><o:p> </o:p></span></p><p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: blue; font-family: "Cascadia Mono"; font-size: 9.5pt;"><span> </span>var</span><span style="font-family: "Cascadia Mono"; font-size: 9.5pt;"> rsa1 =
DotNetUtilities.ToRSA(rsaparams);</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"><span style="mso-spacerun: yes;"> <span> </span></span></span><span style="color: blue; font-family: "Cascadia Mono"; font-size: 9.5pt;">var</span><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"> cert = x509.CopyWithPrivateKey(rsa1);<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: blue; font-family: "Cascadia Mono"; font-size: 9.5pt;"><span> </span>return</span><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;"> cert;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: black; font-family: "Cascadia Mono"; font-size: 9.5pt;">}<o:p></o:p></span></p>
<p class="MsoNormal"><b><u>Troubleshoots-1</u></b></p><p class="MsoNormal">subject should have all correct object , if you pass wrong object then will get error </p><p class="MsoNormal">Error: <span style="color: #cc0000;">"Unknown object id - S - passed to distinguished name"</span></p><p class="MsoNormal">like: <span style="color: blue; font-family: "Cascadia Mono"; font-size: 9.5pt;">string</span><span style="font-family: "Cascadia Mono"; font-size: 9.5pt;"> subject = </span><span style="color: #a31515; font-family: "Cascadia Mono"; font-size: 9.5pt;">"E=test@test.com, CN=Test Name, OU=ORG, O=LSGS, L=Orlando, <span style="background-color: #fcff01;">S</span>=MN,C=US"</span><span style="font-family: "Cascadia Mono"; font-size: 9.5pt;">;</span></p><p class="MsoNormal">Ref: for all correct object to be used see here <a href="https://learn.microsoft.com/en-us/previous-versions/windows/desktop/ldap/distinguished-names">Distinguished Names | Microsoft Learn</a></p><p class="MsoNormal"><b><u>Troubleshoots-2</u></b></p>If you are typing wrong password for key certificate, you will get following error <p></p><div>Error: <span style="color: #cc0000;">Internal.Cryptography.CryptoThrowHelper.WindowsCryptographicException: 'The specified network password is not correct.'</span></div><div><span style="color: #cc0000;"><br /></span></div><div>Make sure you know the correct password.</div><div><span style="color: #cc0000;"><br /></span></div><div><b><u>Troubleshoots-3</u></b></div><div><br /></div><div>If you forgot to create private key at the end then you will get following error </div><div>Error: <span style="color: #cc0000;">No Private key</span></div><div>you must need to add private key by using "<span style="color: blue; font-family: "Cascadia Mono"; font-size: 9.5pt;">var</span><span style="font-family: "Cascadia Mono"; font-size: 9.5pt;"> cert = x509.CopyWithPrivateKey(rsa1);"</span></div>Ritesh_Kesharwanihttp://www.blogger.com/profile/06191918659869264896noreply@blogger.com0tag:blogger.com,1999:blog-7638493.post-52045688022920425782020-05-08T13:36:00.003-07:002020-05-08T13:39:28.801-07:00Error message 401.2.: Unauthorized: Logon failed due to server configuration. IIS Express ASP.NET<div dir="ltr" style="text-align: left;" trbidi="on">
When you are running ASP.net application using visual studio and configured to run with IIS Express and if you are getting following error, I resolved to following below steps.<br />
<br />
<span style="color: red;">Error message 401.2.: Unauthorized: Logon failed due to server configuration.</span><br />
<span style="color: red;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-lfD4GdXPcTQ/XrXDdbM1w_I/AAAAAAAAqv4/VdLz0guSSNwwlBOa2UShRQefV0EzIdx-ACLcBGAsYHQ/s1600/IISExpress-Errort.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1600" data-original-width="993" height="640" src="https://1.bp.blogspot.com/-lfD4GdXPcTQ/XrXDdbM1w_I/AAAAAAAAqv4/VdLz0guSSNwwlBOa2UShRQefV0EzIdx-ACLcBGAsYHQ/s640/IISExpress-Errort.png" width="396" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<span style="color: red;"><br /></span></div>
Ritesh_Kesharwanihttp://www.blogger.com/profile/06191918659869264896noreply@blogger.com0tag:blogger.com,1999:blog-7638493.post-56971340796252615362019-11-22T11:27:00.003-08:002019-11-22T11:27:59.499-08:00Error: Parser Error Message: Could not load type” in Global.asax<div dir="ltr" style="text-align: left;" trbidi="on">
I resolved this error to change project OutputPath property to "bin" instead of "bin\Debug" or "bin\Release"<br />
<br />
Go to the Project right click and select Property > Compile and change <b>"Build output path" to "bin\"</b><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-daag5tWyrPI/Xdg0yAsjfhI/AAAAAAAAlGo/aQXXKqepvqEuOj3UqOIwD0w03zWHXAcwQCLcBGAsYHQ/s1600/test.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" data-original-height="337" data-original-width="1600" height="134" src="https://1.bp.blogspot.com/-daag5tWyrPI/Xdg0yAsjfhI/AAAAAAAAlGo/aQXXKqepvqEuOj3UqOIwD0w03zWHXAcwQCLcBGAsYHQ/s640/test.png" width="640" /></a></div>
<br />
or Unload project and open for Edit and Modify Outputpath property to "bin\" instead of "bin\Debug" or "bin\Release".<br />
and also you can check IIS pool should be in correct .NET version (2.0 or 4.0)</div>
Ritesh_Kesharwanihttp://www.blogger.com/profile/06191918659869264896noreply@blogger.com0tag:blogger.com,1999:blog-7638493.post-56228740374709848472019-11-22T11:01:00.001-08:002019-11-22T11:01:43.320-08:00Create Pipeline build to Push DLL into Nuget Repository using Azure DevOps<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div class="MsoNormal">
Here simple steps to follow and create new Automated Build using Azure DevOps to push your DLLs into NuGet Repository <o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
You mainly needed three task to Restore, Pack and Push library into NuGet repository.</div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
Go to Pipeline > Build > Create New Build , Add following Task on your build </div>
<div class="MsoNormal">
<b><br /></b></div>
<ol start="1" style="margin-top: 0in;" type="1">
<li class="MsoListParagraph" style="margin-left: 0in; mso-list: l0 level1 lfo1;"><b>Get
a Sources<o:p></o:p></b></li>
<ol start="1" style="margin-top: 0in;" type="a">
<li class="MsoListParagraph" style="margin-left: 0in; mso-list: l0 level2 lfo1;">Choose
Repository (TFVC or Git)<b><o:p></o:p></b></li>
</ol>
<li class="MsoListParagraph" style="margin-left: 0in; mso-list: l0 level1 lfo1;"><b>Add
Agent Job</b><o:p></o:p></li>
<ol start="1" style="margin-top: 0in;" type="a">
<li class="MsoListParagraph" style="margin-left: 0in; mso-list: l0 level2 lfo1;">NuGet
Tool Installer : leave all default<o:p></o:p></li>
</ol>
</ol>
<div class="MsoListParagraph" style="margin-left: 1.5in; mso-list: l0 level3 lfo1; mso-text-indent-alt: -9.0pt; text-indent: -1.5in;">
<!--[if !supportLists]--><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;"><span style="font: 7.0pt "Times New Roman";">
</span>i.<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]-->Type:
Map<o:p></o:p></div>
<div class="MsoListParagraph" style="margin-left: 1.5in; mso-list: l0 level3 lfo1; mso-text-indent-alt: -9.0pt; text-indent: -1.5in;">
<!--[if !supportLists]--><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;"><span style="font: 7.0pt "Times New Roman";">
</span>ii.<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]-->Server
Path: choose source code location<o:p></o:p></div>
<div class="MsoListParagraph" style="margin-left: 1.5in; mso-list: l0 level3 lfo1; mso-text-indent-alt: -9.0pt; text-indent: -1.5in;">
<!--[if !supportLists]--><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;"><span style="font: 7.0pt "Times New Roman";">
</span>iii.<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]-->Clean:
true<o:p></o:p></div>
<div class="MsoListParagraph" style="margin-left: 1.5in; mso-list: l0 level3 lfo1; mso-text-indent-alt: -9.0pt; text-indent: -1.5in;">
<!--[if !supportLists]--><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;"><span style="font: 7.0pt "Times New Roman";">
</span>iv.<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]-->Clean
Options: sources<o:p></o:p></div>
<div class="MsoListParagraph" style="margin-left: 1.5in; mso-list: l0 level3 lfo1; mso-text-indent-alt: -9.0pt; text-indent: -1.5in;">
<!--[if !supportLists]--><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;"><span style="font: 7.0pt "Times New Roman";">
</span>v.<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]-->Label
sources: OnSuccess<o:p></o:p></div>
<div class="MsoListParagraph" style="margin-left: 1.5in; mso-list: l0 level3 lfo1; mso-text-indent-alt: -9.0pt; text-indent: -1.5in;">
<!--[if !supportLists]--><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;"><span style="font: 7.0pt "Times New Roman";">
</span>vi.<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]-->Label
format: $(Build.BuildNumber)<o:p></o:p></div>
<ol start="2" style="margin-top: 0in;" type="1">
<ol start="2" style="margin-top: 0in;" type="a">
<li class="MsoListParagraph" style="margin-left: 0in; mso-list: l0 level2 lfo1;"><b>NuGet<span style="mso-spacerun: yes;"> </span>for Restore</b><o:p></o:p></li>
</ol>
</ol>
<div class="MsoListParagraph" style="margin-left: 1.5in; mso-list: l0 level3 lfo1; mso-text-indent-alt: -9.0pt; text-indent: -1.5in;">
<!--[if !supportLists]--><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;"><span style="font: 7.0pt "Times New Roman";">
</span>i.<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]-->Choose
command : <b>restore</b><o:p></o:p></div>
<div class="MsoListParagraph" style="margin-left: 1.5in; text-align: left; text-indent: -1.5in;">
<!--[if !supportLists]--><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;"><span style="font: 7.0pt "Times New Roman";"> </span><span style="font-family: "Times New Roman"; font-stretch: normal; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;">
</span>ii.<span style="font-family: "Times New Roman"; font-stretch: normal; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;"> </span></span></span><!--[endif]--><span style="background: white; color: #333333; font-family: "Segoe UI VSS (Regular)";">Path to solution, packages.config, or project.json (.sln file
path)</span><o:p></o:p></div>
<div class="MsoListParagraph" style="margin-left: 1.5in; text-align: left; text-indent: -1.5in;">
<!--[if !supportLists]--><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;"><span style="font-family: "Times New Roman"; font-stretch: normal; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;"> </span>iii.<span style="font-family: "Times New Roman"; font-stretch: normal; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;"> </span></span></span><!--[endif]--><span style="background: white; color: #333333; font-family: "Segoe UI VSS (Regular)";">Use packages from this Azure Artifacts/TFS feed</span><o:p></o:p></div>
<div class="MsoListParagraph" style="margin-left: 1.5in; text-align: left; text-indent: -1.5in;">
<!--[if !supportLists]--><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;"><span style="font-family: "Times New Roman"; font-stretch: normal; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;"> </span>iv.<span style="font-family: "Times New Roman"; font-stretch: normal; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;"> </span></span></span><!--[endif]--><span style="background: white; color: #333333; font-family: "Segoe UI VSS (Regular)";">Check: Use packages from NuGet.org</span><o:p></o:p></div>
<ol start="2" style="margin-top: 0in;" type="1">
<ol start="3" style="margin-top: 0in;" type="a">
<li class="MsoListParagraph" style="margin-left: 0in; mso-list: l0 level2 lfo1;"><b>Update
AssemblyInfo</b><o:p></o:p></li>
</ol>
</ol>
<div class="MsoListParagraph" style="margin-left: 1.5in; mso-list: l0 level3 lfo1; mso-text-indent-alt: -9.0pt; text-indent: -1.5in;">
<!--[if !supportLists]--><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;"><span style="font: 7.0pt "Times New Roman";">
</span>i.<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]-->Root
Folder: $(Build.SourcesDirectory)<o:p></o:p></div>
<div class="MsoListParagraph" style="margin-left: 1.5in; mso-list: l0 level3 lfo1; mso-text-indent-alt: -9.0pt; text-indent: -1.5in;">
<!--[if !supportLists]--><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;"><span style="font: 7.0pt "Times New Roman";">
</span>ii.<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]-->File
pattern (AssemblyInfo.cs)<o:p></o:p></div>
<div class="MsoListParagraph" style="margin-left: 1.5in; mso-list: l0 level3 lfo1; mso-text-indent-alt: -9.0pt; text-indent: -1.5in;">
<!--[if !supportLists]--><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;"><span style="font: 7.0pt "Times New Roman";">
</span>iii.<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]-->Version:
$(Build.BuildNumber)<o:p></o:p></div>
<div class="MsoListParagraph" style="margin-left: 1.5in; mso-list: l0 level3 lfo1; mso-text-indent-alt: -9.0pt; text-indent: -1.5in;">
<!--[if !supportLists]--><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;"><span style="font: 7.0pt "Times New Roman";">
</span>iv.<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]-->File
Version: $(Build.BuildNumber)<o:p></o:p></div>
<ol start="2" style="margin-top: 0in;" type="1">
<ol start="4" style="margin-top: 0in;" type="a">
<li class="MsoListParagraph" style="margin-left: 0in; mso-list: l0 level2 lfo1;"><b>Visual
Studio Build</b><o:p></o:p></li>
</ol>
</ol>
<div class="MsoListParagraph" style="margin-left: 1.5in; mso-list: l0 level3 lfo1; mso-text-indent-alt: -9.0pt; text-indent: -1.5in;">
<!--[if !supportLists]--><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;"><span style="font: 7.0pt "Times New Roman";">
</span>i.<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]-->Solution
:<span style="mso-spacerun: yes;"> </span>.sln file path<o:p></o:p></div>
<div class="MsoListParagraph" style="margin-left: 1.5in; mso-list: l0 level3 lfo1; mso-text-indent-alt: -9.0pt; text-indent: -1.5in;">
<!--[if !supportLists]--><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;"><span style="font: 7.0pt "Times New Roman";">
</span>ii.<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]-->Visual
Studio Version: Latest<o:p></o:p></div>
<div class="MsoListParagraph" style="margin-left: 1.5in; mso-list: l0 level3 lfo1; mso-text-indent-alt: -9.0pt; text-indent: -1.5in;">
<!--[if !supportLists]--><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;"><span style="font: 7.0pt "Times New Roman";">
</span>iii.<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]-->Platform
: AnyCPU<o:p></o:p></div>
<div class="MsoListParagraph" style="margin-left: 1.5in; mso-list: l0 level3 lfo1; mso-text-indent-alt: -9.0pt; text-indent: -1.5in;">
<!--[if !supportLists]--><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;"><span style="font: 7.0pt "Times New Roman";">
</span>iv.<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]-->Configuration:
Release<o:p></o:p></div>
<div class="MsoListParagraph" style="margin-left: 1.5in; mso-list: l0 level3 lfo1; mso-text-indent-alt: -9.0pt; text-indent: -1.5in;">
<!--[if !supportLists]--><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;"><span style="font: 7.0pt "Times New Roman";">
</span>v.<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]-->Check:
Clean<o:p></o:p></div>
<ol start="2" style="margin-top: 0in;" type="1">
<ol start="5" style="margin-top: 0in;" type="a">
<li class="MsoListParagraph" style="margin-left: 0in; mso-list: l0 level2 lfo1;"><b>NuGet
(for pack)</b><o:p></o:p></li>
</ol>
</ol>
<div class="MsoListParagraph" style="margin-left: 1.5in; mso-list: l0 level3 lfo1; mso-text-indent-alt: -9.0pt; text-indent: -1.5in;">
<!--[if !supportLists]--><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;"><span style="font: 7.0pt "Times New Roman";">
</span>i.<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]-->Command:
<b>pack</b><o:p></o:p></div>
<div class="MsoListParagraph" style="margin-left: 1.5in; mso-list: l0 level3 lfo1; mso-text-indent-alt: -9.0pt; text-indent: -1.5in;">
<!--[if !supportLists]--><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;"><span style="font: 7.0pt "Times New Roman";">
</span>ii.<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]-->Path
for proj or nuspec<o:p></o:p></div>
<div class="MsoListParagraph" style="margin-left: 1.5in; mso-list: l0 level3 lfo1; mso-text-indent-alt: -9.0pt; text-indent: -1.5in;">
<!--[if !supportLists]--><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;"><span style="font: 7.0pt "Times New Roman";">
</span>iii.<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]-->Pack
Option: “Use the build number”<o:p></o:p></div>
<ol start="2" style="margin-top: 0in;" type="1">
<ol start="6" style="margin-top: 0in;" type="a">
<li class="MsoListParagraph" style="margin-left: 0in; mso-list: l0 level2 lfo1;"><b>NuGet
(for Push)</b><o:p></o:p></li>
</ol>
</ol>
<div class="MsoListParagraph" style="margin-left: 1.5in; mso-list: l0 level3 lfo1; mso-text-indent-alt: -9.0pt; text-indent: -1.5in;">
<!--[if !supportLists]--><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;"><span style="font: 7.0pt "Times New Roman";">
</span>i.<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]-->Command
: <b>push</b><o:p></o:p></div>
<div class="MsoListParagraph" style="margin-left: 1.5in; mso-list: l0 level3 lfo1; mso-text-indent-alt: -9.0pt; text-indent: -1.5in;">
<!--[if !supportLists]--><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;"><span style="font: 7.0pt "Times New Roman";">
</span>ii.<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]-->Path
to NuGet package to publish ($(Build.ArtifactStagingDirectory)/*.nupkg)<o:p></o:p></div>
<div class="MsoListParagraph" style="margin-left: 1.5in; mso-list: l0 level3 lfo1; mso-text-indent-alt: -9.0pt; text-indent: -1.5in;">
<!--[if !supportLists]--><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;"><span style="font: 7.0pt "Times New Roman";">
</span>iii.<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]-->Target
Feed: <span style="font-size: x-small;">“<span style="background: white; color: black; font-family: "Segoe UI", sans-serif;">Select a feed hosted in this account. You must
have Package Management installed and licensed to select a feed here.”</span></span></div>
<div class="MsoListParagraph" style="margin-left: 1.5in; mso-list: l0 level3 lfo1; mso-text-indent-alt: -9.0pt; text-indent: -1.5in;">
<span style="font-size: x-small;"><span style="background: white; color: black; font-family: "Segoe UI", sans-serif;"><br /></span></span></div>
<div class="MsoListParagraph" style="margin-left: 1.5in; mso-list: l0 level3 lfo1; mso-text-indent-alt: -9.0pt; text-indent: -1.5in;">
<span style="font-family: Segoe UI, sans-serif; font-size: x-small;"><span style="background-color: white;">Go to this video for more details </span></span></div>
<div class="MsoListParagraph" style="margin-left: 1.5in; mso-list: l0 level3 lfo1; mso-text-indent-alt: -9.0pt; text-indent: -1.5in;">
<a href="https://docs.microsoft.com/en-us/azure/devops/pipelines/get-started/?view=azure-devops">https://docs.microsoft.com/en-us/azure/devops/pipelines/get-started/?view=azure-devops</a></div>
<div class="MsoListParagraph" style="margin-left: 1.5in; mso-list: l0 level3 lfo1; mso-text-indent-alt: -9.0pt; text-indent: -1.5in;">
<br /></div>
</div>
Ritesh_Kesharwanihttp://www.blogger.com/profile/06191918659869264896noreply@blogger.com0tag:blogger.com,1999:blog-7638493.post-58109456829702647112019-11-22T10:50:00.002-08:002019-11-22T10:50:47.677-08:00Common errors when you automate build using Azure DevOps build<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div class="MsoNormal">
<u>Error-1</u></div>
<div class="MsoNormal">
<o:p></o:p></div>
<div class="MsoNormal">
<span style="color: red;">The nuget command failed with exit code(1) and
error(System.AggregateException: One or more errors occurred. --->
System.InvalidOperationException: Cannot determine the packages folder to
restore NuGet packages. Please specify either -PackagesDirectory or
-SolutionDirectory.</span></div>
<br />
<u>Solution</u><br />
I observed this error when I was trying to create automated build using Azure DevOps Pipeline and I changed **/*.csproj from **/*.Sln as a file to build.<br />
<br />
To Resolve this error, in the Pipeline Task select <u>NuGet</u> & use <u>Pack </u>Option instead of Restore Option, Restore Option work for Solution file only not for project file.<br />
<br />
<u>Error-2</u><br />
<div class="MsoNormal">
<span style="color: red;">C:\Program Files (x86)\Microsoft Visual
Studio\2019\BuildTools\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(775,5):
Error : The OutputPath property is not set for project
'ABC.csproj'. Please check
to make sure that you have specified a valid combination of Configuration and
Platform for this project.
Configuration='Release'
Platform='Any CPU'. You may be
seeing this message because you are trying to build a project without a
solution file, and have specified a non-default Configuration or Platform that
doesn't exist for this project.</span><o:p></o:p></div>
<div class="MsoNormal">
<span style="color: red;"><br /></span></div>
<div class="MsoNormal">
<u>Solution</u></div>
<div class="MsoNormal">
Again if you are switching from .Sln file to .csproj or .vbproj file to be build then make sure you are selecting the correct "Platform" property.</div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
For Project file , Platform property value is "AnyCPU" and </div>
<div class="MsoNormal">
For Solution file, Platform property value is "Any CPU" (with space)</div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
so, you need to open project file in notepad and check PropertyGroup section and OutputPath tag should look like below.</div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<PropertyGroup Condition="
'$(Configuration)|$(Platform)' == 'Release|AnyCPU' "><o:p></o:p></div>
<div class="MsoNormal">
<OutputPath>bin\Release\</OutputPath></div>
<div class="MsoNormal">
.</div>
<div class="MsoNormal">
.</div>
<div class="MsoNormal">
</PropertyGroup></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<u>Error-3</u></div>
<div class="MsoNormal">
<span style="color: red;">Response status code does not indicate success: 409
(Conflict - The feed already contains “*.dll </span><<span style="color: red;">Version Number</span>><span style="color: red;">”)</span></div>
<div class="MsoNormal">
<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<u>Solution:</u><o:p></o:p></div>
<div class="MsoNormal">
When you get this error that mean project is building correctly but not increasing the build number, so server trying to push same dll version into NuGet and it not allow duplicate version number, and throw 409 error</div>
<div class="MsoNormal">
If you choose "Skip duplicate version" option then it will resolve the issues but that will not be correct because latest version never deployed into NuGet server. </div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
The best solution I found, in NuGet Task select following option </div>
<div class="MsoNormal">
<o:p></o:p></div>
<div class="MsoNormal">
Command : <b>pack</b><o:p></o:p></div>
<div class="MsoNormal">
</div>
<div class="MsoNormal">
Automatic package versioning : <b>Use the build numbers <o:p></o:p></b></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
This will create new version every time when new DLL build successfully, so No 409 error.</div>
<div class="MsoNormal">
<o:p></o:p></div>
<br />
<div class="MsoNormal">
<o:p></o:p></div>
<u></u></div>
Ritesh_Kesharwanihttp://www.blogger.com/profile/06191918659869264896noreply@blogger.com0tag:blogger.com,1999:blog-7638493.post-68319541894619436512019-11-13T08:54:00.001-08:002019-11-13T08:54:16.297-08:00Error: The visual tree has been changed during a 'VisualTreeChanged' event.<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="color: red;">Error: <code><span class="SubError">The visual tree has been changed during a
'VisualTreeChanged' event.</span></code></span><br />
<br />
<code><span class="SubError"><u><b>Solution: </b></u></span></code><br />
<code><span class="SubError"><b>Go to Visual Studio, Tools >> Options and unchecked "Enable UI Debugging Tools for XMAL"</b></span></code><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-vtLWWXGjBAU/XcwxP_t-MSI/AAAAAAAAk48/SIjTC2NJQVMr6abY5R0iOTV29Jnp4jqLACLcBGAsYHQ/s1600/IIS-1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="574" data-original-width="854" height="430" src="https://1.bp.blogspot.com/-vtLWWXGjBAU/XcwxP_t-MSI/AAAAAAAAk48/SIjTC2NJQVMr6abY5R0iOTV29Jnp4jqLACLcBGAsYHQ/s640/IIS-1.png" width="640" /></a></div>
<span style="color: red;"><code><span class="SubError"><u><b> </b></u> </span></code></span></div>
Ritesh_Kesharwanihttp://www.blogger.com/profile/06191918659869264896noreply@blogger.com0tag:blogger.com,1999:blog-7638493.post-77534467165540659312019-11-12T17:09:00.003-08:002019-11-12T17:09:53.613-08:00Error: The authentication schemes configured on the host ('Ntlm, Anonymous') do not allow those configured on the binding 'BasicHttpBinding' ('Negotiate'). Please ....<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="color: red;"><b>Error</b>: </span><i><span style="color: red; font-size: small;">The authentication schemes configured on the host ('Ntlm, Anonymous') do not allow those configured on the binding 'BasicHttpBinding' ('Negotiate'). Please ensure that the SecurityMode is set to Transport or TransportCredentialOnly. Additionally, this may be resolved by changing the authentication schemes for this application through the IIS management tool, through the ServiceHost.Authentication.AuthenticationSchemes property, in the application configuration file at the <serviceauthenticationmanager> element, by updating the ClientCredentialType property on the binding, or by adjusting the AuthenticationScheme property on the HttpTransportBindingElement.</serviceauthenticationmanager></span></i><br />
<div>
<i><span style="font-size: small;"><u><br /></u></span></i></div>
<div>
<i><span style="font-size: small;"><u><b>Solution:</b></u></span></i></div>
<div>
<i><span style="font-size: small; font-weight: normal;"><br /></span></i></div>
<div>
I have done following two things in IIS setting to resolve following error<br />
<br />
1) Make sure for Hosted WebSite/App two Authentication option is set to Enabled<br />
<i>Anonymous Authentication = Enabled and Window Authentication = Enabled</i><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-VzplfmKDmW8/XctWIKTTEwI/AAAAAAAAk4k/vllqrFPoWNkWS0fpLhBXZ8I4k_Tvg_vFQCLcBGAsYHQ/s1600/IIS-1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="308" data-original-width="611" height="321" src="https://1.bp.blogspot.com/-VzplfmKDmW8/XctWIKTTEwI/AAAAAAAAk4k/vllqrFPoWNkWS0fpLhBXZ8I4k_Tvg_vFQCLcBGAsYHQ/s640/IIS-1.png" width="640" /></a></div>
<br />
2) Right click on Window Authentication >> Providers<br />
make sure you have NTLM and Negotiate is added as Enabled Providers, If not just add it.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-WK45Qm4cHgU/XctXcpPuRvI/AAAAAAAAk4w/CrhlUm2CTKAKma56WKdp7NbuRuYJvDwcgCLcBGAsYHQ/s1600/IIS-1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="446" data-original-width="552" height="516" src="https://1.bp.blogspot.com/-WK45Qm4cHgU/XctXcpPuRvI/AAAAAAAAk4w/CrhlUm2CTKAKma56WKdp7NbuRuYJvDwcgCLcBGAsYHQ/s640/IIS-1.png" width="640" /></a></div>
<br /></div>
<div>
<br /></div>
</div>
Ritesh_Kesharwanihttp://www.blogger.com/profile/06191918659869264896noreply@blogger.com0tag:blogger.com,1999:blog-7638493.post-46179309733340983852019-05-19T21:58:00.002-07:002019-05-19T22:06:36.040-07:00How to add innerHTML or Multi line text to NgbPopover<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div class="MsoNormal">
<span style="color: black; font-size: 13.5pt;">I was trying to
show multi line text on Popover and want to format my display contain as I want
using HTML tag. text construction has to be done in .ts file.<o:p></o:p></span></div>
<div class="MsoNormal" style="-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; orphans: 2; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;">
<br /></div>
<div class="MsoNormal" style="-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; orphans: 2; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;">
<span style="color: black; font-size: 13.5pt;">I achieved this in following way.<o:p></o:p></span><u1:p></u1:p></div>
<div class="MsoNormal" style="-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; orphans: 2; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;">
<br /></div>
<div class="MsoNormal" style="-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; orphans: 2; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;">
<span style="color: black; font-size: 13.5pt;">Label where, on mouseover I want to show popover with employee
detail data.<o:p></o:p></span><u1:p></u1:p></div>
<div class="MsoNormal" style="-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; orphans: 2; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;">
<span style="color: black; font-size: 13.5pt;">I want when use mouseover then popover display and if user click
outside or click “esc” then popover disappears. You can also use moverover and
mouse leave using </span><span style="color: red; font-family: "consolas"; font-size: 9.5pt;">triggers</span><span style="color: blue; font-family: "consolas"; font-size: 9.5pt;">="mouseenter:mouseleave"<o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div style="margin-bottom: .0001pt; margin: 0in;">
<span style="background: #f7f7f7; color: black; font-family: "courier new";">npm install --save @ng-bootstrap/ng-bootstrap</span><span style="color: black; font-size: 13.5pt;"><o:p></o:p></span></div>
<div style="margin-bottom: .0001pt; margin: 0in;">
<b><u><span style="color: black; font-size: 13.5pt;"><br /></span></u></b>
<b><u><span style="color: black; font-size: 13.5pt;">app.module.ts</span></u></b><br />
<b><u><span style="color: black; font-size: 13.5pt;"><br /></span></u></b></div>
<div class="MsoNormal" style="-webkit-text-stroke-width: 0px; background: white; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 14.25pt; orphans: 2; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;">
<u1:p></u1:p><span style="color: green; font-family: "consolas"; font-size: 10.5pt;">//Popover- menu item</span><span style="color: black; font-family: "consolas"; font-size: 10.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt;">
<span style="color: blue; font-family: "consolas"; font-size: 10.5pt;">import</span><span style="color: black; font-family: "consolas"; font-size: 10.5pt;"> { NgbPopoverModule,
NgbModalModule, NgbAlertModule } </span><span style="color: blue; font-family: "consolas"; font-size: 10.5pt;">from</span><span style="color: black; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: #a31515; font-family: "consolas"; font-size: 10.5pt;">'@ng-bootstrap/ng-bootstrap'</span><span style="color: black; font-family: "consolas"; font-size: 10.5pt;">;</span></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt;">
<span style="color: black; font-family: "consolas"; font-size: 10.5pt;">@NgModule({imports:
[NgbPopoverModule]})<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt;">
<br /></div>
<div class="MsoNormal" style="-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; orphans: 2; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;">
<b><u><span style="color: black; font-size: 13.5pt;">Employee.html file</span></u></b><u1:p><span style="color: black; font-size: 13.5pt;"> </span></u1:p><br />
<u1:p><span style="color: black; font-size: 13.5pt;"><br /></span></u1:p></div>
<div class="MsoNormal" style="-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; orphans: 2; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;">
<o:p></o:p></div>
<div class="MsoNormal" style="-webkit-text-stroke-width: 0px; background: white; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 14.25pt; orphans: 2; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;">
<span style="color: maroon; font-family: "consolas"; font-size: 10.5pt;"><label span=""><span style="color: black; font-family: "consolas"; font-size: 10.5pt;"> <label </span><span style="color: red; font-family: "consolas"; font-size: 10.5pt;">id</span><span style="color: black; font-family: "consolas"; font-size: 10.5pt;">=</span><span style="color: blue; font-family: "consolas"; font-size: 10.5pt;">"EmployeeProfile"</span><span style="color: black; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: red; font-family: "consolas"; font-size: 10.5pt;">class</span><span style="color: black; font-family: "consolas"; font-size: 10.5pt;">=</span><span style="color: blue; font-family: "consolas"; font-size: 10.5pt;">"readmore-p"</span><span style="color: black; font-family: "consolas"; font-size: 10.5pt;"> <u1:p></u1:p></span><span style="color: black; font-size: 13.5pt;"><o:p></o:p></span></label></span></div>
<div class="MsoNormal" style="-webkit-text-stroke-width: 0px; background: white; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 14.25pt; orphans: 2; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;">
<span style="color: black; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: red; font-family: "consolas"; font-size: 10.5pt;">name</span><span style="color: black; font-family: "consolas"; font-size: 10.5pt;">=</span><span style="color: blue; font-family: "consolas"; font-size: 10.5pt;">"EmployeeProfile "<u1:p></u1:p></span><span style="color: black; font-size: 13.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="-webkit-text-stroke-width: 0px; background: white; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 14.25pt; margin-left: .5in; orphans: 2; text-decoration-color: initial; text-decoration-style: initial; text-indent: .5in; widows: 2; word-spacing: 0px;">
<span style="color: red; font-family: "consolas"; font-size: 10.5pt;">(mouseover)</span><span style="color: black; font-family: "consolas"; font-size: 10.5pt;">=</span><span style="color: blue; font-family: "consolas"; font-size: 10.5pt;">"getEmployeeProfileData()"</span><span style="color: black; font-size: 13.5pt;"><u1:p></u1:p><o:p></o:p></span></div>
<div class="MsoNormal" style="-webkit-text-stroke-width: 0px; background: white; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 14.25pt; orphans: 2; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;">
<span style="color: black; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: red; font-family: "consolas"; font-size: 10.5pt;">[ngbPopover]</span><span style="color: black; font-family: "consolas"; font-size: 10.5pt;">=</span><span style="color: blue; font-family: "consolas"; font-size: 10.5pt;">"<b>ShowEmployeeProfile</b>"</span><span style="color: black; font-family: "consolas"; font-size: 10.5pt;"> <u1:p></u1:p></span><span style="color: black; font-size: 13.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="-webkit-text-stroke-width: 0px; background: white; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 14.25pt; margin-left: .5in; orphans: 2; text-decoration-color: initial; text-decoration-style: initial; text-indent: .5in; widows: 2; word-spacing: 0px;">
<span style="color: red; font-family: "consolas"; font-size: 10.5pt;">popoverTitle</span><span style="color: black; font-family: "consolas"; font-size: 10.5pt;">=</span><span style="color: blue; font-family: "consolas"; font-size: 10.5pt;">"Employee Detail Profile"</span><span style="color: black; font-size: 13.5pt;"><u1:p></u1:p><o:p></o:p></span></div>
<div class="MsoNormal" style="-webkit-text-stroke-width: 0px; background: white; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 14.25pt; orphans: 2; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;">
<span style="color: black; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: red; font-family: "consolas"; font-size: 10.5pt;">triggers</span><span style="color: black; font-family: "consolas"; font-size: 10.5pt;">=</span><span style="color: blue; font-family: "consolas"; font-size: 10.5pt;">"mouseenter"</span><span style="color: black; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: red; font-family: "consolas"; font-size: 10.5pt;">[autoClose]</span><span style="color: black; font-family: "consolas"; font-size: 10.5pt;">=</span><span style="color: blue; font-family: "consolas"; font-size: 10.5pt;">"'outside'"</span><span style="color: maroon; font-family: "consolas"; font-size: 10.5pt;">></span><br />
</label<span style="color: maroon; font-family: "consolas"; font-size: 14px;">></span></div>
</div>
<div class="MsoNormal" style="-webkit-text-stroke-width: 0px; background: white; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 14.25pt; orphans: 2; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;">
<span style="color: maroon; font-family: "consolas"; font-size: 14px;"><br /></span></div>
<div class="MsoNormal" style="-webkit-text-stroke-width: 0px; background: white; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 14.25pt; orphans: 2; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;">
<span style="color: maroon; font-family: "consolas"; font-size: 10.5pt;"><ng-template span=""><span style="color: black; font-family: "consolas"; font-size: 10.5pt;"> <</span></ng-template></span><span style="color: maroon; font-family: "consolas"; font-size: 10.5pt;">ng-template</span><span style="font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: red; font-family: "consolas"; font-size: 10.5pt;">#</span><b style="color: maroon; font-family: consolas; font-size: 10.5pt;"><span style="color: blue; font-family: "consolas"; font-size: 10.5pt;">ShowEmployeeProfile </span></b><span style="color: maroon; font-family: "consolas"; font-size: 10.5pt;">></span></div>
<div class="MsoNormal" style="-webkit-text-stroke-width: 0px; background: white; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 14.25pt; orphans: 2; text-decoration-color: initial; text-decoration-style: initial; text-indent: .5in; widows: 2; word-spacing: 0px;">
<div span="">
<span style="color: maroon; font-size: 10.5pt;"><span style="color: black; font-family: "consolas"; font-size: 10.5pt;"> <div</span><span style="color: red; font-family: "consolas"; font-size: 10.5pt;">[innerHtml]</span><span style="color: black; font-family: "consolas"; font-size: 10.5pt;">=</span><span style="color: blue; font-family: "consolas"; font-size: 10.5pt;">"employeeDetailDataForToolTip"</</span><span style="color: blue; font-family: "consolas"; font-size: 10.5pt;">div</span></span><span style="color: maroon; font-family: "consolas"; font-size: 10.5pt; text-indent: 0.5in;">></span><br />
<span style="color: maroon; font-family: "consolas"; font-size: 10.5pt; text-indent: 0.5in;"></</span><span style="color: maroon; font-family: "consolas"; font-size: 10.5pt; text-indent: 0.5in;">ng-template</span><span style="color: maroon; font-family: "consolas"; font-size: 10.5pt; text-indent: 0.5in;">></span><br />
<b style="text-indent: 0.5in;"><u><span style="color: maroon; font-family: "consolas"; font-size: 10.5pt;"><br /></span></u></b>
<b style="text-indent: 0.5in;"><u><span style="color: maroon; font-family: "consolas"; font-size: 10.5pt;">Employee.ts
file</span></u></b></div>
</div>
<div class="MsoNormal" style="-webkit-text-stroke-width: 0px; background: white; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 14.25pt; orphans: 2; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;">
<span style="color: black; font-family: "consolas"; font-size: 10.5pt;"><br /></span>
<span style="color: black; font-family: "consolas"; font-size: 10.5pt;">employeeDetailDataForToolTip:
string =</span><span style="color: #a31515; font-family: "consolas"; font-size: 10.5pt;">""</span><span style="color: black; font-family: "consolas"; font-size: 10.5pt;">;</span><br />
<span style="color: black; font-family: "consolas"; font-size: 10.5pt;"><br /></span></div>
<div class="MsoNormal" style="-webkit-text-stroke-width: 0px; background: white; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 14.25pt; orphans: 2; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;">
<span style="color: blue; font-family: "consolas"; font-size: 10.5pt;">getEmployeeProfileData</span><span style="color: black; font-family: "consolas"; font-size: 10.5pt;">(): string<u1:p></u1:p></span><span style="color: black; font-size: 13.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="-webkit-text-stroke-width: 0px; background: white; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 14.25pt; orphans: 2; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;">
<span style="color: black; font-family: "consolas"; font-size: 10.5pt;">{</span><br />
<span style="color: blue; font-family: "consolas" , "courier new" , monospace; font-size: 14px; white-space: pre;">this</span><span style="font-family: "consolas" , "courier new" , monospace; font-size: 14px; white-space: pre;">.</span><span style="font-family: "consolas"; font-size: 14px;">employeeDetailDataForToolTip</span><span style="font-family: "consolas" , "courier new" , monospace; font-size: 14px; white-space: pre;">=</span><span style="color: #a31515; font-family: "consolas" , "courier new" , monospace; font-size: 14px; white-space: pre;">""</span><span style="font-family: "consolas" , "courier new" , monospace; font-size: 14px; white-space: pre;">;</span><br />
<span style="color: blue; font-family: "consolas" , "courier new" , monospace; font-size: 14px; white-space: pre;">this</span><span style="font-family: "consolas" , "courier new" , monospace; font-size: 14px; white-space: pre;">.</span><span style="font-family: "consolas"; font-size: 14px;">employeeDetailDataForToolTip</span><span style="font-family: "consolas" , "courier new" , monospace; font-size: 14px; white-space: pre;">+=</span><span style="color: #a31515; font-family: "consolas" , "courier new" , monospace; font-size: 14px; white-space: pre;">'<ul></span><span style="color: #a31515; font-family: "consolas" , "courier new" , monospace; font-size: 14px; white-space: pre;"><u></span><span style="color: #a31515; font-family: "consolas" , "courier new" , monospace; font-size: 14px; white-space: pre;">Ritesh Kesharwani</span><span style="color: #a31515; font-family: "consolas" , "courier new" , monospace; font-size: 14px; white-space: pre;"></u></span><span style="color: #a31515; font-family: "consolas" , "courier new" , monospace; font-size: 14px; white-space: pre;">'</span><span style="font-family: "consolas" , "courier new" , monospace; font-size: 14px; white-space: pre;">;</span><br />
<span style="color: blue; font-family: consolas, "courier new", monospace; font-size: 14px; white-space: pre;">this</span><span style="font-family: consolas, "courier new", monospace; font-size: 14px; white-space: pre;">.</span><span style="font-family: "consolas"; font-size: 14px;">employeeDetailDataForToolTip</span><span style="font-family: consolas, "courier new", monospace; font-size: 14px; white-space: pre;">+=</span><span style="color: #a31515; font-family: consolas, "courier new", monospace; font-size: 14px; white-space: pre;">'</span><span style="color: #a31515; font-family: consolas, "courier new", monospace; font-size: 14px; white-space: pre;"><li></span><span style="color: #a31515; font-family: consolas, "courier new", monospace; font-size: 14px; white-space: pre;">Address: Mile City, USA</span><span style="color: #a31515; font-family: consolas, "courier new", monospace; font-size: 14px; white-space: pre;"></lt;li></span><span style="color: #a31515; font-family: consolas, "courier new", monospace; font-size: 14px; white-space: pre;">';</span><br />
<span style="color: blue; font-family: consolas, "courier new", monospace; font-size: 14px; white-space: pre;">this</span><span style="font-family: consolas, "courier new", monospace; font-size: 14px; white-space: pre;">.</span><span style="font-family: "consolas"; font-size: 14px;">employeeDetailDataForToolTip</span><span style="font-family: consolas, "courier new", monospace; font-size: 14px; white-space: pre;">+=</span><span style="color: #a31515; font-family: consolas, "courier new", monospace; font-size: 14px; white-space: pre;">'</span><span style="color: #a31515; font-family: consolas, "courier new", monospace; font-size: 14px; white-space: pre;"><li></span><span style="color: #a31515; font-family: consolas, "courier new", monospace; font-size: 14px; white-space: pre;"> Department: Education</span><span style="color: #a31515; font-family: consolas, "courier new", monospace; font-size: 14px; white-space: pre;"></li></span><span style="color: #a31515; font-family: consolas, "courier new", monospace; font-size: 14px; white-space: pre;">'</span><span style="font-family: consolas, "courier new", monospace; font-size: 14px; white-space: pre;">;</span><br />
<span style="color: blue; font-family: consolas, "courier new", monospace; font-size: 14px; white-space: pre;">this</span><span style="font-family: consolas, "courier new", monospace; font-size: 14px; white-space: pre;">.</span><span style="font-family: "consolas"; font-size: 14px;">employeeDetailDataForToolTip</span><span style="font-family: consolas, "courier new", monospace; font-size: 14px; white-space: pre;">+=</span><span style="color: #a31515; font-family: consolas, "courier new", monospace; font-size: 14px; white-space: pre;">'</span><span style="color: #a31515; font-family: consolas, "courier new", monospace; font-size: 14px; white-space: pre;"><li></span><span style="color: #a31515; font-family: consolas, "courier new", monospace; font-size: 14px; white-space: pre;"> Salary: $300000</span><span style="color: #a31515; font-family: consolas, "courier new", monospace; font-size: 14px; white-space: pre;"></li></span><span style="color: #a31515; font-family: consolas, "courier new", monospace; font-size: 14px; white-space: pre;">'</span><span style="font-family: consolas, "courier new", monospace; font-size: 14px; white-space: pre;">;</span><br />
<span style="color: blue; font-family: "consolas" , "courier new" , monospace; font-size: 14px; white-space: pre;">this</span><span style="font-family: "consolas" , "courier new" , monospace; font-size: 14px; white-space: pre;">.</span><span style="font-family: "consolas"; font-size: 14px; white-space: pre;">employeeDetailDataForToolTip</span><span style="font-family: "consolas" , "courier new" , monospace; font-size: 14px; white-space: pre;">+=</span><span style="color: #a31515; font-family: "consolas" , "courier new" , monospace; font-size: 14px; white-space: pre;">'</span><span style="color: #a31515; font-family: "consolas" , "courier new" , monospace; font-size: 14px; white-space: pre;"><li> </span><span style="color: #a31515; font-family: "consolas" , "courier new" , monospace; font-size: 14px; white-space: pre;">Base Location: MN</span><span style="color: #a31515; font-family: "consolas" , "courier new" , monospace; font-size: 14px; white-space: pre;"></li></span><span style="color: #a31515; font-family: "consolas" , "courier new" , monospace; font-size: 14px; white-space: pre;"></ul></span><span style="color: #a31515; font-family: "consolas" , "courier new" , monospace; font-size: 14px; white-space: pre;">'</span><br />
<span style="font-family: consolas; font-size: 10.5pt; white-space: pre;">}</span></div>
<div class="MsoNormal" style="-webkit-text-stroke-width: 0px; background: white; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 14.25pt; orphans: 2; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;">
<div style="font-family: Consolas, "Courier New", monospace; font-size: 14px; line-height: 19px; white-space: pre;">
<span style="font-family: "consolas"; font-size: 10.5pt;">If you want scroll bar on Popover then you need to override style sheet</span><br />
<span style="color: maroon; font-family: "consolas"; font-size: 10.5pt;">.popover</span><span style="color: black; font-family: "consolas"; font-size: 10.5pt;"> {</span></div>
</div>
<div class="MsoNormal" style="-webkit-text-stroke-width: 0px; background: white; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 14.25pt; orphans: 2; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;">
<span style="color: black; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: red; font-family: "consolas"; font-size: 10.5pt;">max-width</span><span style="color: black; font-family: "consolas"; font-size: 10.5pt;">: </span><span style="color: #09885a; font-family: "consolas"; font-size: 10.5pt;">500px</span><span style="color: black; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: blue; font-family: "consolas"; font-size: 10.5pt;">!important</span><span style="color: black; font-family: "consolas"; font-size: 10.5pt;">;<u1:p></u1:p></span><span style="color: black; font-size: 13.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="-webkit-text-stroke-width: 0px; background: white; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 14.25pt; orphans: 2; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;">
<span style="color: black; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: red; font-family: "consolas"; font-size: 10.5pt;">background</span><span style="color: black; font-family: "consolas"; font-size: 10.5pt;">: </span><span style="color: #0451a5; font-family: "consolas"; font-size: 10.5pt;">#F9F9F9</span><span style="color: black; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: blue; font-family: "consolas"; font-size: 10.5pt;">!important</span><span style="color: black; font-family: "consolas"; font-size: 10.5pt;">;<u1:p></u1:p></span><span style="color: black; font-size: 13.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="-webkit-text-stroke-width: 0px; background: white; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 14.25pt; orphans: 2; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;">
<span style="color: black; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: red; font-family: "consolas"; font-size: 10.5pt;">max-height</span><span style="color: black; font-family: "consolas"; font-size: 10.5pt;">: </span><span style="color: #09885a; font-family: "consolas"; font-size: 10.5pt;">400px</span><span style="color: black; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: blue; font-family: "consolas"; font-size: 10.5pt;">!important</span><span style="color: black; font-family: "consolas"; font-size: 10.5pt;">;<u1:p></u1:p></span><span style="color: black; font-size: 13.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="-webkit-text-stroke-width: 0px; background: white; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 14.25pt; orphans: 2; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;">
<span style="color: black; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: red; font-family: "consolas"; font-size: 10.5pt;">overflow</span><span style="color: black; font-family: "consolas"; font-size: 10.5pt;">: </span><span style="color: #0451a5; font-family: "consolas"; font-size: 10.5pt;">scroll</span><span style="color: black; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: blue; font-family: "consolas"; font-size: 10.5pt;">!important</span><span style="color: black; font-family: "consolas"; font-size: 10.5pt;">;<u1:p></u1:p></span><span style="color: black; font-size: 13.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="-webkit-text-stroke-width: 0px; background: white; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 14.25pt; orphans: 2; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;">
<span style="color: black; font-family: "consolas"; font-size: 10.5pt;">}</span></div>
<div class="MsoNormal" style="-webkit-text-stroke-width: 0px; background: white; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 14.25pt; orphans: 2; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;">
<span style="color: black; font-family: "consolas"; font-size: 10.5pt;"><br /></span></div>
<div class="MsoNormal" style="-webkit-text-stroke-width: 0px; background: white; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 14.25pt; orphans: 2; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;">
<span style="color: black; font-family: "consolas"; font-size: 10.5pt;">sample pop over on label mouse over </span></div>
<div class="MsoNormal" style="-webkit-text-stroke-width: 0px; background: white; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 14.25pt; orphans: 2; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;">
<span style="color: black; font-family: "consolas"; font-size: 10.5pt;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-k3ALN5WwZ60/XOIvGJY7KoI/AAAAAAAAdgc/U9uETYpgpLUFgzw-uVgAQwIvRs8v_EVoQCLcBGAs/s1600/popover.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" data-original-height="228" data-original-width="284" src="https://4.bp.blogspot.com/-k3ALN5WwZ60/XOIvGJY7KoI/AAAAAAAAdgc/U9uETYpgpLUFgzw-uVgAQwIvRs8v_EVoQCLcBGAs/s1600/popover.png" /></a></div>
<div class="MsoNormal" style="-webkit-text-stroke-width: 0px; background: white; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 14.25pt; orphans: 2; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;">
<span style="color: black; font-family: "consolas"; font-size: 10.5pt;"><br /></span></div>
</div>
Ritesh_Kesharwanihttp://www.blogger.com/profile/06191918659869264896noreply@blogger.com0tag:blogger.com,1999:blog-7638493.post-61805186110504702272019-05-07T13:26:00.004-07:002019-05-07T13:26:46.587-07:00During Test Debug control not hits to the break points + Not able to debug test case<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div class="MsoNormal">
Go to the project property > Build and Uncheck following<o:p></o:p></div>
<div class="MsoNormal">
</div>
<ul style="text-align: left;">
<li>Allow unsafe code</li>
<li>Optimize Code</li>
</ul>
<o:p></o:p><br />
<div class="MsoNormal">
<o:p></o:p></div>
<div class="MsoNormal">
<o:p> </o:p>And Select Platform target: Any CPU</div>
<div class="MsoNormal">
<o:p></o:p></div>
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-766lfuPBqTI/XNHp18wPGiI/AAAAAAAAdWs/gBGXKSaSWroIQ-9FySGkJ1Hfs0UaVcWwQCLcBGAs/s1600/TestDebugError.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="506" data-original-width="584" src="https://4.bp.blogspot.com/-766lfuPBqTI/XNHp18wPGiI/AAAAAAAAdWs/gBGXKSaSWroIQ-9FySGkJ1Hfs0UaVcWwQCLcBGAs/s1600/TestDebugError.png" /></a></div>
<br /></div>
Ritesh_Kesharwanihttp://www.blogger.com/profile/06191918659869264896noreply@blogger.com0tag:blogger.com,1999:blog-7638493.post-73217159302255237032019-05-07T13:20:00.004-07:002019-05-07T13:20:47.295-07:00Error: testhost.x86.exe' has exited with code 0 (0x0).<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div class="MsoNormal">
<b>Error: testhost.x86.exe' has exited with code 0 (0x0).</b></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
After my research I found, below nuget package was missing
from my project.</div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<o:p></o:p></div>
<div class="MsoNormal">
I have installed below and it resolved the issue.<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;">MSTest.TestFramework<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 9.5pt;">Make sure following package are installed in your test project</span></div>
<div class="MsoNormal">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;"><br /></span></div>
MSTest.TestFramework And MSTest.TestAdapter<br />
<br /></div>
Ritesh_Kesharwanihttp://www.blogger.com/profile/06191918659869264896noreply@blogger.com0tag:blogger.com,1999:blog-7638493.post-54294196031282292592019-05-06T17:08:00.001-07:002019-05-06T17:08:24.826-07:00Render Date field in specific Date Format into ag-Grid Angular 6<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="MsoNormal">
<span style="background-color: white;">In you ag-Grid
if you want to display date field in specific format do the following steps</span></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt;">
<o:p></o:p></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt;">
<br /></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt; margin-left: .25in;">
</div>
<ol style="text-align: left;">
<li>npm Install moment --save</li>
<li>in your .ts file use below </li>
</ol>
<o:p></o:p><br />
<div class="MsoNormal" style="background: white; line-height: 14.25pt; margin-left: .25in;">
<o:p></o:p></div>
<div class="MsoListParagraphCxSpFirst">
<span style="color: blue; font-family: Consolas; font-size: 10.5pt;"><o:p> </o:p></span><span style="color: blue; font-family: Consolas; font-size: 10.5pt;">import</span><span style="font-family: Consolas; font-size: 10.5pt;"> </span><span style="color: blue; font-family: Consolas; font-size: 10.5pt;">*</span><span style="font-family: Consolas; font-size: 10.5pt;"> </span><span style="color: blue; font-family: Consolas; font-size: 10.5pt;">as</span><span style="font-family: Consolas; font-size: 10.5pt;"> moment </span><span style="color: blue; font-family: Consolas; font-size: 10.5pt;">from</span><span style="font-family: Consolas; font-size: 10.5pt;"> </span><span style="color: #a31515; font-family: Consolas; font-size: 10.5pt;">'moment'</span><span style="font-family: Consolas; font-size: 10.5pt;">;</span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt;">
<span style="color: black; font-family: Consolas; font-size: 10.5pt;">columnDefs = <o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt; text-indent: .5in;">
<span style="color: black; font-family: Consolas; font-size: 10.5pt;">[{<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt; text-indent: .5in;">
<span style="color: black; font-family: Consolas; font-size: 10.5pt;">headerName: </span><span style="color: #a31515; font-family: Consolas; font-size: 10.5pt;">'Effective Start
Date'</span><span style="color: black; font-family: Consolas; font-size: 10.5pt;">,
field: </span><span style="color: #a31515; font-family: Consolas; font-size: 10.5pt;">'EffectiveStartDate'</span><span style="color: black; font-family: Consolas; font-size: 10.5pt;">,</span><b style="mso-bidi-font-weight: normal;"><o:p></o:p></b></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt; text-indent: .5in;">
<span style="color: black; font-family: Consolas; font-size: 10.5pt;">cellRenderer: (data) </span><span style="color: blue; font-family: Consolas; font-size: 10.5pt;">=></span><span style="color: black; font-family: Consolas; font-size: 10.5pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt; margin-left: .5in;">
<span style="color: blue; font-family: Consolas; font-size: 10.5pt;">return</span><span style="color: black; font-family: Consolas; font-size: 10.5pt;"><span style="mso-spacerun: yes;"> </span>data.value ? (moment(data.value).format(</span><span style="color: #a31515; font-family: Consolas; font-size: 10.5pt;">'MM/DD/YYYY'</span><span style="color: black; font-family: Consolas; font-size: 10.5pt;">)) : </span><span style="color: #a31515; font-family: Consolas; font-size: 10.5pt;">''</span><span style="color: black; font-family: Consolas; font-size: 10.5pt;">;} <o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt; margin-left: .5in;">
<span style="color: black; font-family: Consolas; font-size: 10.5pt;">}]; <o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
For more info on moment please use <a href="https://momentjs.com/">https://momentjs.com/</a><o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<br /></div>
</div>
Ritesh_Kesharwanihttp://www.blogger.com/profile/06191918659869264896noreply@blogger.com0tag:blogger.com,1999:blog-7638493.post-85728949827335498302019-05-06T17:04:00.004-07:002019-05-06T17:05:21.247-07:00Add hyperlink click event into ag-Grid Angular 6<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="MsoNormal">
<div class="MsoNormal">
I had spent lots of time to figure how to add hyperlink into
ag-grid column and how to call function executed at on click event. This was looking
very difficult but later it came with very simple solution.<o:p></o:p></div>
<div class="MsoNormal">
My requirement was to add hyperlink on Grid column with the rendered
data, so no button where we have static word like “Add” etc.<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
Simple solution I could figure out is to add cellClicked event<o:p></o:p></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt;">
<u><span style="color: maroon; font-family: "consolas"; font-size: 10.5pt;"><br /></span></u></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt;">
<u><span style="color: maroon; font-family: "consolas"; font-size: 10.5pt;">.html page<o:p></o:p></span></u></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt;">
<u><span style="color: maroon; font-family: "consolas"; font-size: 10.5pt;"><br /></span></u></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt;">
<span style="color: maroon; font-family: "consolas"; font-size: 10.5pt;"><ag-grid-angular</span></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt;">
<span style="font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: red; font-family: "consolas"; font-size: 10.5pt;">(cellClicked)</span><span style="font-family: "consolas"; font-size: 10.5pt;">=</span><span style="color: blue; font-family: "consolas"; font-size: 10.5pt;">'onCellClicked($event)'</span><span style="color: maroon; font-family: "consolas"; font-size: 10.5pt;">></span><span style="font-family: "consolas"; font-size: 10.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt;">
<span style="color: maroon; font-family: "consolas"; font-size: 10.5pt;"></ag-grid-angular></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
And when cellClicked by user execute Type Script function<o:p></o:p></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt;">
<u><span style="color: maroon; font-family: "consolas"; font-size: 10.5pt;"><br /></span></u></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt;">
<u><span style="color: maroon; font-family: "consolas"; font-size: 10.5pt;">.ts page<o:p></o:p></span></u></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt;">
<span style="font-family: "consolas"; font-size: 10.5pt;"><br /></span></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt;">
<span style="font-family: "consolas"; font-size: 10.5pt;">onViewCellClicked(event:
any) <o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt;">
<span style="font-family: "consolas"; font-size: 10.5pt;"> { <o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt;">
<span style="font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: blue; font-family: "consolas"; font-size: 10.5pt;">if</span><span style="font-family: "consolas"; font-size: 10.5pt;"> (event.column.colId ==</span><span style="color: #a31515; font-family: "consolas"; font-size: 10.5pt;">"FirstName"</span><span style="font-family: "consolas"; font-size: 10.5pt;"> ) </span><span style="color: green; font-family: "consolas"; font-size: 10.5pt;">// only first column
clicked</span><span style="font-family: "consolas"; font-size: 10.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt;">
<span style="font-family: "consolas"; font-size: 10.5pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt;">
<span style="font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: green; font-family: "consolas"; font-size: 10.5pt;">// execute the action as you want here in on
click of hyperlink</span><span style="font-family: "consolas"; font-size: 10.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt;">
<span style="font-family: "consolas"; font-size: 10.5pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt; margin-left: .5in;">
<span style="color: green; font-family: "consolas"; font-size: 10.5pt;">// here you can add
multiple if statement based on colId to do the action //on cell clicked<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt;">
<span style="font-family: "consolas"; font-size: 10.5pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt;">
<br /></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt;">
<span style="font-family: "consolas"; font-size: 10.5pt;">Your column definition
as below <o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt;">
<br /></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt;">
<span style="font-family: "consolas"; font-size: 10.5pt;">columnDefs = [{<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt; margin-left: 1.0in;">
<span style="font-family: "consolas"; font-size: 10.5pt;">headerName:
</span><span style="color: #a31515; font-family: "consolas"; font-size: 10.5pt;">'First
Name'</span><span style="font-family: "consolas"; font-size: 10.5pt;">,
field: </span><span style="color: #a31515; font-family: "consolas"; font-size: 10.5pt;">'FirstName'</span><span style="font-family: "consolas"; font-size: 10.5pt;">, suppressMenu: </span><span style="color: blue; font-family: "consolas"; font-size: 10.5pt;">false</span><span style="font-family: "consolas"; font-size: 10.5pt;">, unSortIcon: </span><span style="color: blue; font-family: "consolas"; font-size: 10.5pt;">true</span><span style="font-family: "consolas"; font-size: 10.5pt;">, width:</span><span style="color: #09885a; font-family: "consolas"; font-size: 10.5pt;">150</span><span style="font-family: "consolas"; font-size: 10.5pt;">,<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt; text-indent: .5in;">
<span style="font-family: "consolas"; font-size: 10.5pt;"> cellRenderer: </span><span style="color: blue; font-family: "consolas"; font-size: 10.5pt;">function</span><span style="font-family: "consolas"; font-size: 10.5pt;">(params) {<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt; text-indent: .5in;">
<span style="color: green; font-family: "consolas"; font-size: 10.5pt;"> // below line is just to create empty
without any action hyperlink<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt; margin-left: 1.0in; text-indent: 6.0pt;">
<span style="color: green; font-family: "consolas"; font-size: 10.5pt;">// to trick the user, but actual action happen onViewCellCliced() //
function </span><span style="font-family: "consolas"; font-size: 10.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt; text-indent: .5in;">
<span style="font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: blue; font-family: "consolas"; font-size: 10.5pt;">return</span><span style="font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: #a31515; font-family: "consolas"; font-size: 10.5pt;">'<a href="#">'</span><span style="font-family: "consolas"; font-size: 10.5pt;"> + params.value + </span><span style="color: #a31515; font-family: "consolas"; font-size: 10.5pt;">'</a>'</span><span style="font-family: "consolas"; font-size: 10.5pt;">;<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt;">
<span style="font-family: "consolas"; font-size: 10.5pt;"> },<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: 14.25pt; text-indent: .5in;">
<span style="font-family: "consolas"; font-size: 10.5pt;"> tooltipField:
</span><span style="color: #a31515; font-family: "consolas"; font-size: 10.5pt;">"FirstName"</span><span style="font-family: "consolas"; font-size: 10.5pt;">, headerTooltip: </span><span style="color: #a31515; font-family: "consolas"; font-size: 10.5pt;">"First
Name"</span><span style="font-family: "consolas"; font-size: 10.5pt;"> <o:p></o:p></span></div>
<span style="font-family: "consolas"; font-size: 10.5pt;"> }];</span></div>
</div>
</div>
Ritesh_Kesharwanihttp://www.blogger.com/profile/06191918659869264896noreply@blogger.com3tag:blogger.com,1999:blog-7638493.post-67674451561678919362018-06-07T07:34:00.002-07:002018-06-07T07:34:42.425-07:00Error: 'IApplicationBuilder' does not contain a definition for 'UseIdentityServerAuthentication' and...<div dir="ltr" style="text-align: left;" trbidi="on">
When I was trying to implement security to one of my .net core Web API, I encountered below error<br />
<span style="color: red;"><br /></span>
<span style="color: red;">'IApplicationBuilder' does not contain a definition for 'UseIdentityServerAuthentication' and no extension method 'UseIdentityServerAuthentication' accepting a first argument of type 'IApplicationBuilder' could be found (are you missing a using directive or an assembly reference?)</span><br />
<span style="color: red;"><br /></span>
After long struggle, I found that .Net Core 2.0 does not support the security the way .NET Core 1.0 used to support, Code need to rewritten in different way, actually need to follow the steps to migrate your Web API to .NET Core 2.0 using Microsoft.AspNetCore.Authentication.JwtBearer; <br />
<br />
Please follow migration steps to resolve this issues<br />
<span style="color: black;"><a href="https://elanderson.net/2017/09/identity-server-api-migration-to-asp-net-core-2/">https://elanderson.net/2017/09/identity-server-api-migration-to-asp-net-core-2/</a></span></div>
Ritesh_Kesharwanihttp://www.blogger.com/profile/06191918659869264896noreply@blogger.com1tag:blogger.com,1999:blog-7638493.post-48356821296974836942017-09-09T11:41:00.001-07:002017-09-09T11:41:28.249-07:00$window.open('url') directs to currenthost + url instead of just url in AngularJS<div dir="ltr" style="text-align: left;" trbidi="on">
<h1 itemprop="name" style="background-color: white; border: 0px; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-stretch: inherit; font-variant-numeric: inherit; line-height: 1.3; margin: 0px 0px 0.5em; padding: 0px; vertical-align: baseline;">
<span style="color: #cc0000; font-size: small;"><u>Issues:</u></span><span style="font-size: small; font-weight: normal;">When I am trying following code in AngularJS, it works but opening new window with url like below </span></h1>
<h1 itemprop="name" style="background-color: white; border: 0px; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-stretch: inherit; font-variant-numeric: inherit; line-height: 1.3; margin: 0px 0px 0.5em; padding: 0px; vertical-align: baseline;">
<span style="font-weight: normal;"><span style="font-size: small;">http://localhost/pages/www.facebook.com</span></span></h1>
<div>
<span style="background-color: white; color: #242729; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-size: 22px; font-weight: inherit;">JS File</span></div>
<div>
<div>
$scope.OpenWindow = function (url, _blank) {</div>
<div>
window.open(url, '_blank', 'heigth=600,width=600');</div>
<div>
}</div>
</div>
<div>
<b>HTML File</b></div>
<div>
<b><br /></b></div>
<div>
img class="FacebookIcon" ng-click="OpenWindow('www.facebook.com')"</div>
<div>
<div>
<span style="color: #cc0000; font-weight: bold;"><u><br /></u></span></div>
<div>
<span style="color: #cc0000; font-weight: bold;"><u>Solution:</u> </span>Add 'http://' in the url</div>
</div>
<div>
<br /></div>
<div>
<div>
<span style="background-color: white; color: #242729; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-size: 22px; font-weight: inherit;">JS File</span></div>
<div>
$scope.OpenWindow = function (url, _blank) {</div>
<div>
<div>
window.open(<b><span style="color: #cc0000;"> "http://" + url</span></b>, '_blank', 'heigth=600,width=600');</div>
<div>
}</div>
<div>
<br /></div>
<div>
It will work and open <span style="background-color: white; color: #242729; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-weight: inherit;">https://www.facebook.com</span></div>
</div>
</div>
<div>
<span style="background-color: white; color: #242729; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-weight: inherit;"><br /></span></div>
</div>
Ritesh_Kesharwanihttp://www.blogger.com/profile/06191918659869264896noreply@blogger.com0tag:blogger.com,1999:blog-7638493.post-71886442186221147962017-06-30T08:18:00.000-07:002017-06-30T08:18:36.506-07:00.NET Core 1.0.1 Entity Framework – Scaffolding<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="MsoNormal">
If you are using .NET Core version 1.0.1, you might have
faced some issues to auto-generate database context and Model. There is one
more option available to generate database context using command prompt. <o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
But you have to take care of adding supported/matched DLL reference
from Nuget/Nexus.<o:p></o:p></div>
<div class="MsoNormal">
Go to “project.json” file and make sure you have added
following references<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<table border="1" cellpadding="0" cellspacing="0" class="MsoTableGrid" style="border-collapse: collapse; border: none; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 0in 5.4pt 0in 5.4pt; mso-yfti-tbllook: 1184;">
<tbody>
<tr>
<td style="border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 440.75pt;" valign="top" width="588"><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"> </span><span style="color: #2e75b6; font-family: "consolas"; font-size: 9.5pt;">"dependencies"</span><span style="font-family: "consolas"; font-size: 9.5pt;">: {<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"> </span><span style="color: #2e75b6; font-family: "consolas"; font-size: 9.5pt;">"Microsoft.NETCore.App"</span><span style="font-family: "consolas"; font-size: 9.5pt;">: {<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"> </span><span style="color: #2e75b6; font-family: "consolas"; font-size: 9.5pt;">"version"</span><span style="font-family: "consolas"; font-size: 9.5pt;">: </span><span style="color: #a31515; font-family: "consolas"; font-size: 9.5pt;">"1.0.1"</span><span style="font-family: "consolas"; font-size: 9.5pt;">,<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"> </span><span style="color: #2e75b6; font-family: "consolas"; font-size: 9.5pt;">"type"</span><span style="font-family: "consolas"; font-size: 9.5pt;">: </span><span style="color: #a31515; font-family: "consolas"; font-size: 9.5pt;">"platform"</span><span style="font-family: "consolas"; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"> },<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"> </span><span style="color: #2e75b6; font-family: "consolas"; font-size: 9.5pt;">"Microsoft.AspNetCore.Diagnostics"</span><span style="font-family: "consolas"; font-size: 9.5pt;">: </span><span style="color: #a31515; font-family: "consolas"; font-size: 9.5pt;">"1.0.0"</span><span style="font-family: "consolas"; font-size: 9.5pt;">,<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"> </span><span style="color: #2e75b6; font-family: "consolas"; font-size: 9.5pt;">"Microsoft.AspNetCore.Server.IISIntegration"</span><span style="font-family: "consolas"; font-size: 9.5pt;">: </span><span style="color: #a31515; font-family: "consolas"; font-size: 9.5pt;">"1.0.0"</span><span style="font-family: "consolas"; font-size: 9.5pt;">,<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"> </span><span style="color: #2e75b6; font-family: "consolas"; font-size: 9.5pt;">"Microsoft.AspNetCore.Server.Kestrel"</span><span style="font-family: "consolas"; font-size: 9.5pt;">: </span><span style="color: #a31515; font-family: "consolas"; font-size: 9.5pt;">"1.0.1"</span><span style="font-family: "consolas"; font-size: 9.5pt;">,<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"> </span><span style="color: #2e75b6; font-family: "consolas"; font-size: 9.5pt;">"Microsoft.Extensions.Logging.Console"</span><span style="font-family: "consolas"; font-size: 9.5pt;">: </span><span style="color: #a31515; font-family: "consolas"; font-size: 9.5pt;">"1.0.0"</span><span style="font-family: "consolas"; font-size: 9.5pt;">,<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"> </span><span style="color: #2e75b6; font-family: "consolas"; font-size: 9.5pt;">"Microsoft.Entityframeworkcore.Sqlserver"</span><span style="font-family: "consolas"; font-size: 9.5pt;">: </span><span style="color: #a31515; font-family: "consolas"; font-size: 9.5pt;">"1.0.0"</span><span style="font-family: "consolas"; font-size: 9.5pt;">,<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"> </span><span style="color: #2e75b6; font-family: "consolas"; font-size: 9.5pt;">"Microsoft.EntityFrameworkCore.SqlServer.Design"</span><span style="font-family: "consolas"; font-size: 9.5pt;">: </span><span style="color: #a31515; font-family: "consolas"; font-size: 9.5pt;">"1.0.0"</span><span style="font-family: "consolas"; font-size: 9.5pt;">,<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"> </span><span style="color: #2e75b6; font-family: "consolas"; font-size: 9.5pt;">"Microsoft.EntityFrameworkCore.Design"</span><span style="font-family: "consolas"; font-size: 9.5pt;">: </span><span style="color: #a31515; font-family: "consolas"; font-size: 9.5pt;">"1.0.0-preview2-final"</span><span style="font-family: "consolas"; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"> },<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"> </span><span style="color: #2e75b6; font-family: "consolas"; font-size: 9.5pt;">"tools"</span><span style="font-family: "consolas"; font-size: 9.5pt;">: {<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"> </span><span style="color: #2e75b6; font-family: "consolas"; font-size: 9.5pt;">"Microsoft.EntityFrameworkCore.Tools"</span><span style="font-family: "consolas"; font-size: 9.5pt;">: </span><span style="color: #a31515; font-family: "consolas"; font-size: 9.5pt;">"1.0.0-preview2-final"</span><span style="font-family: "consolas"; font-size: 9.5pt;">,<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"> </span><span style="color: #2e75b6; font-family: "consolas"; font-size: 9.5pt;">"Microsoft.AspNetCore.Server.IISIntegration.Tools"</span><span style="font-family: "consolas"; font-size: 9.5pt;">: </span><span style="color: #a31515; font-family: "consolas"; font-size: 9.5pt;">"1.0.0-preview2-final"</span><span style="font-family: "consolas"; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;">
<span style="font-family: "consolas"; font-size: 9.5pt;"> },</span><o:p></o:p></div>
</td>
</tr>
</tbody></table>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
Now go to the folder where “project.json” file exist and
open command prompt.<o:p></o:p></div>
<div class="MsoNormal" style="margin-left: 0.25in;">
</div>
<ol>
<li>Generate database Model for selected table only</li>
</ol>
<i><span style="font-size: 10pt; line-height: 14.2667px;"><b> C:/Ritesh/EFScafoldingDemo:></b></span></i> <b><span style="color: #0070c0; font-size: 9pt; line-height: 12.84px;">dotnet ef dbcontext scaffold “Server={db server name},{port number};Database={db name};Trusted_Connection=True;” Microsoft.Entityframeworkcore.Sqlserver</span><span style="color: #0070c0;"> </span></b><b><span style="color: red; font-size: 9pt; line-height: 12.84px;">–t “Product”,”Order”</span></b><br />
<ol>
<li>Generate entire database Model </li>
</ol>
<div class="MsoNormal" style="margin-left: .5in;">
<i><span style="font-size: 10.0pt; line-height: 107%;"><b>C:/Ritesh/EFScafoldingDemo:></b></span></i>
<b><span style="color: #0070c0; font-size: 9.0pt; line-height: 107%;">dotnet ef dbcontext scaffold “Server={db server name},{port
number};Database= db name};Trusted_Connection=True;” Microsoft.Entityframeworkcore.Sqlserver</span></b></div>
<div class="MsoNormal" style="margin-left: .5in;">
<b><span style="color: #0070c0; font-size: 9.0pt; line-height: 107%;"><br /></span></b></div>
<div class="MsoNormal" style="margin-left: .5in;">
There are multiple option available
to generate database model for .NET Core entity framework, you can see from <a href="https://docs.microsoft.com/en-us/ef/core/miscellaneous/cli/dotnet">Microsoft
site</a> for more detail<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
After above command executed successfully you can see, dbProductContext.db
, Product.cs, Order.cs files.<o:p></o:p></div>
</div>
Ritesh_Kesharwanihttp://www.blogger.com/profile/06191918659869264896noreply@blogger.com0tag:blogger.com,1999:blog-7638493.post-90813823042512324392017-06-23T07:39:00.005-07:002017-06-23T07:39:47.542-07:00.NET Core or .NET Framework, What is right for your application?<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="lf-text-block lf-block" data-lf-anchor-id="81e06d4ddfd574d1426b6dd3042476f0:0" style="background-color: white; color: #222222; font-family: segoe-ui_normal, "Segoe UI", Segoe, "Segoe WP", "Helvetica Neue", Helvetica, sans-serif; font-size: 16px; margin-top: 1rem; padding-right: 25px !important; position: relative !important;">
.NET Framework and .NET Core are two choices for building .NET server-side applications. Both share a lot of the same .NET platform components and you can share code across the two. However, there are fundamental differences between the two and based on what you want to accomplish, your requirement your choice will depend. </div>
<div class="lf-text-block lf-block" data-lf-anchor-id="81e06d4ddfd574d1426b6dd3042476f0:0" style="background-color: white; color: #222222; font-family: segoe-ui_normal, "Segoe UI", Segoe, "Segoe WP", "Helvetica Neue", Helvetica, sans-serif; font-size: 16px; margin-top: 1rem; padding-right: 25px !important; position: relative !important;">
You should <u><b>use .NET Core</b></u> for your server application when:</div>
<div class="lf-text-block lf-block" data-lf-anchor-id="475a0908a40131b20ef115d2072942f9:0" style="background-color: white; color: #222222; font-family: segoe-ui_normal, "Segoe UI", Segoe, "Segoe WP", "Helvetica Neue", Helvetica, sans-serif; font-size: 16px; margin-top: 1rem; padding-right: 25px !important; position: relative !important;">
<span class="lf-thread-btn" style="position: absolute !important; right: 0px !important; top: 0px !important;"></span></div>
<ul class="lf-text-block lf-block" data-lf-anchor-id="613fad1e46b331aa4cc70595133d7ef9:0" style="background-color: white; color: #222222; font-family: segoe-ui_normal, "Segoe UI", Segoe, "Segoe WP", "Helvetica Neue", Helvetica, sans-serif; font-size: 16px; margin: 16px 0px 16px 38px; padding-bottom: 0px; padding-left: 0px; padding-right: 25px !important; padding-top: 0px; position: relative !important;">
<li style="list-style: disc outside none;">You have cross-platform needs.</li>
<li style="list-style: disc outside none;">You are targeting microservices.</li>
<li style="list-style: disc outside none;">You are using Docker containers.</li>
<li style="list-style: disc outside none;">You need high performance and scalable systems.</li>
<li style="list-style: disc outside none;">You need side by side of .NET versions by application.</li>
<span class="lf-thread-btn" style="position: absolute !important; right: 0px !important; top: 0px !important;"></span></ul>
<div class="lf-text-block lf-block" data-lf-anchor-id="57560d08a50134b206d311da052840f9:0" style="background-color: white; color: #222222; font-family: segoe-ui_normal, "Segoe UI", Segoe, "Segoe WP", "Helvetica Neue", Helvetica, sans-serif; font-size: 16px; margin-top: 1rem; padding-right: 25px !important; position: relative !important;">
You should <b><u>use .NET Framework</u></b> for your server application when:<span class="lf-thread-btn" style="position: absolute !important; right: 0px !important; top: 0px !important;"></span></div>
<ul class="lf-text-block lf-block" data-lf-anchor-id="41fa6149449ab0a14fc73fd6d72551f1:0" style="background-color: white; color: #222222; font-family: segoe-ui_normal, "Segoe UI", Segoe, "Segoe WP", "Helvetica Neue", Helvetica, sans-serif; font-size: 16px; margin: 16px 0px 16px 38px; padding-bottom: 0px; padding-left: 0px; padding-right: 25px !important; padding-top: 0px; position: relative !important;">
<li style="list-style: disc outside none;">Your application currently uses .NET Framework (recommendation is to extend instead of migrating)</li>
<li style="list-style: disc outside none;">You need to use third-party .NET libraries or NuGet packages not available for .NET Core.</li>
<li style="list-style: disc outside none;">You need to use .NET technologies that are not available for .NET Core.</li>
<li style="list-style: disc outside none;">You need to use a platform that doesn’t support .NET Core.</li>
</ul>
<div>
<span style="color: #222222; font-family: segoe-ui_normal, Segoe UI, Segoe, Segoe WP, Helvetica Neue, Helvetica, sans-serif;">Ref: <a href="https://docs.microsoft.com/en-us/dotnet/standard/choosing-core-framework-server">https://docs.microsoft.com/en-us/dotnet/standard/choosing-core-framework-server</a></span></div>
<div>
<span style="color: #222222; font-family: segoe-ui_normal, Segoe UI, Segoe, Segoe WP, Helvetica Neue, Helvetica, sans-serif;"><br /></span></div>
</div>
Ritesh_Kesharwanihttp://www.blogger.com/profile/06191918659869264896noreply@blogger.com10tag:blogger.com,1999:blog-7638493.post-68220045131995207542017-04-20T12:13:00.004-07:002017-09-09T11:44:27.594-07:00Steps require to host your application into the Pivotal Cloud Foundry <div dir="ltr" style="text-align: left;" trbidi="on">
<div class="MsoTitle" style="text-align: left;">
<span style="font-family: "georgia" , "times new roman" , serif;"><span style="font-size: large;">Host your application
into the Pivotal Cloud Foundry PCF</span><o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoListParagraph" style="text-align: left;">
<span style="font-family: "georgia" , "times new roman" , serif;">Register in Pivotal and go to “Pivotal Web Services”, you will get free trial upto 2 GB<o:p></o:p></span></div>
<div class="MsoListParagraph">
<span style="font-family: "georgia" , "times new roman" , serif;"><span style="color: windowtext;"><a href="https://account.run.pivotal.io/z/uaa/sign-up">https://account.run.pivotal.io/z/uaa/sign-up</a></span><o:p></o:p></span></div>
<div class="MsoListParagraph">
<span style="font-family: "georgia" , "times new roman" , serif;"><br /></span></div>
<div class="MsoListParagraph" style="text-align: left;">
<span style="font-family: "georgia" , "times new roman" , serif;"><o:p> </o:p>If you already have an account in PCF then Login using </span></div>
<div class="MsoListParagraph">
<span style="color: blue; font-family: "georgia" , "times new roman" , serif;"><a href="https://login.run.pivotal.io/login">https://login.run.pivotal.io/login</a> With
User Id: Email Id and Pwd: Password</span></div>
<div class="MsoListParagraph">
<br /></div>
<div class="MsoListParagraph">
<span style="font-family: "georgia" , "times new roman" , serif;">You will need a workspace where app can be hosted,
for that you need to create Organization and then Workspace <o:p></o:p></span></div>
<div class="MsoListParagraph">
<span style="font-family: "georgia" , "times new roman" , serif;"><span style="color: blue;">Go to Given/Created Org >> Click Add Space
>> create new space for you</span><o:p></o:p></span></div>
<div class="MsoListParagraph">
<br /></div>
<div class="MsoListParagraph">
<span style="font-family: "georgia" , "times new roman" , serif;">For CF push to work, you will need manifest.yml file
to be a part of your app’s output folder.<o:p></o:p></span></div>
<div class="MsoListParagraph">
<span style="color: blue; font-family: "georgia" , "times new roman" , serif;">Sample manifest.yml file content </span><o:p></o:p></div>
<div class="MsoListParagraph">
<br />
<b><u>.NET Framework aAps, yml file </u></b><br />
<b><u><br /></u></b></div>
<table border="1" cellpadding="0" cellspacing="0" class="MsoTableGrid" style="border-collapse: collapse; border: none; margin-left: .5in; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 0in 5.4pt 0in 5.4pt; mso-yfti-tbllook: 1184;">
<tbody>
<tr>
<td style="border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 242.75pt;" valign="top" width="324"><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; font-family: "consolas";"><span style="color: blue;">---<o:p></o:p></span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; font-family: "consolas";"><span style="color: blue;">applications:<o:p></o:p></span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; font-family: "consolas";"><span style="color: blue;">- name: RiteshWebAPI<o:p></o:p></span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; font-family: "consolas";"><span style="color: blue;"> memory: 512m<o:p></o:p></span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; font-family: "consolas";"><span style="color: blue;"> disk_quota: 512m <o:p></o:p></span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; font-family: "consolas";"><span style="color: blue;"> buildpack: binary_buildpack<o:p></o:p></span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; font-family: "consolas";"><span style="color: blue;"> stack: windows2012R2<o:p></o:p></span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; font-family: "consolas";"><span style="color: blue;"> env:<o:p></o:p></span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; font-family: "consolas";"><span style="color: blue;"> ConnectionString:
@SQLConnectionString@<o:p></o:p></span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; font-family: "consolas";"><span style="color: blue;"> App_Log: @AppLogConnection@<o:p></o:p></span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; font-family: "consolas";"><span style="color: blue;"> services:<o:p></o:p></span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; font-family: "consolas";"><span style="color: blue;"> - syslog-drain<o:p></o:p></span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; font-family: "consolas";"><span style="color: blue;">routes:<o:p></o:p></span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; font-family: "consolas";"><span style="color: blue;"> - route: @route@<o:p></o:p></span></span></div>
<div class="MsoListParagraph" style="margin-left: 0in;">
<span style="background: white; font-family: "consolas";"><span style="color: blue;">instances:
@instances@</span></span><o:p></o:p></div>
</td>
</tr>
</tbody></table>
<b><u><br /></u></b>
<br />
<div>
<b><u>.NET Core Apps</u></b>, buildpack and stack will be changed , run > cf buildpacks or > cf stacks to see available buildpack and stack in PCF environment.<br />
<div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0in;">
<span style="background: white; font-family: "consolas";"><span style="color: blue;"> </span></span><span style="color: blue; font-family: "consolas";"> buildpack: dotnet_core_buildpack</span><br />
<span style="color: blue; font-family: "consolas";"> stack: cflinuxfs2</span></div>
<div class="MsoListParagraph">
<br /></div>
<div class="MsoListParagraph">
<span style="font-family: "georgia" , "times new roman" , serif;">Build your App, WebAPI, WebApp etc. Following things
needs to be taken care while code, Code need to follow 12 factor app <a href="https://12factor.net/">https://12factor.net/</a></span><br />
<span style="color: blue; font-family: "georgia" , "times new roman" , serif; text-indent: -0.25in;">Best Practices for ASP.Net application </span><b style="color: blue; font-family: georgia, "times new roman", serif; text-indent: -0.25in;">Application Types:</b><b style="color: blue; font-family: georgia, "times new roman", serif; text-indent: -0.25in;"><span style="font-size: 32pt;"> </span>MVC, WebForm,
WebAPI, WCF</b><br />
<br />
<ul style="text-align: left;">
<li>Avoid Integrated Windows Authentication</li>
<li>Avoid the Global Access Cache (GAC)</li>
<li>Avoid custom IIS handlers</li>
<li>Avoid anything that uses the Windows registry</li>
<li>Avoid using local disk for storing application
state. Any data that needs to <span style="text-indent: -0.25in;">persist needs to be stored in backing service.
Ex. Database (SQL Server,</span><span style="text-indent: -0.25in;">Mongo DB)</span></li>
<li>Avoid in process session state.</li>
<li>For ASP.NET override MachineKey in web.config and on ASP.NET Core</li>
<li>Avoid persisting keyring to filesystem</li>
<li>On ASP.NET avoid environment specific configuration in web.config<span style="font-family: "georgia" , "times new roman" , serif; text-indent: -0.25in;"> </span></li>
<li>Avoid using any Windows specific or disk based
logging</li>
<li>Avoid any 32-bit specific libraries or libraries
that cannot be bin deployable.</li>
</ul>
</div>
<div class="MsoListParagraphCxSpMiddle" style="line-height: 105%; margin-bottom: 8.0pt; margin-left: 1.5in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; mso-list: l2 level1 lfo3; text-indent: -.25in;">
<o:p></o:p></div>
<div class="MsoListParagraph">
<span style="font-family: "georgia" , "times new roman" , serif;">Once your App is ready you can publish it in some
folder let’s say </span><span style="color: blue; font-family: "georgia" , "times new roman" , serif;">“C:\Ritesh\WebAPIPublish\”</span></div>
<div class="MsoListParagraph">
<span style="font-family: "georgia" , "times new roman" , serif;"><o:p> </o:p> </span></div>
<div class="MsoListParagraph">
<span style="font-family: "georgia" , "times new roman" , serif;">First steps to start your deployment into the PCF,
you need Common Language Interface (CLI) <span style="color: blue;">Download CLI from below<o:p></o:p></span></span></div>
<div class="MsoListParagraph">
<span style="font-family: "georgia" , "times new roman" , serif;"><a href="https://docs.cloudfoundry.org/cf-cli/install-go-cli.html"><span style="color: blue;">https://docs.cloudfoundry.org/cf-cli/install-go-cli.html</span></a><o:p></o:p></span></div>
<div class="MsoListParagraph">
<br /></div>
<div class="MsoListParagraph">
<span style="font-family: "georgia" , "times new roman" , serif;">Now, Open Command Prompt (cmd), type following
commands to login <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-left: .25in; text-indent: .25in;">
<span style="color: blue; font-family: "georgia" , "times new roman" , serif;">Login By Browser
URL: <a href="https://login.run.pivotal.io/login">https://login.run.pivotal.io/login</a><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-left: .25in; text-indent: .25in;">
<span style="font-family: "georgia" , "times new roman" , serif;"><span style="color: blue;">Login By CLI
URL: <a href="https://api.run.pivotal.io/">https://api.run.pivotal.io/</a></span><o:p></o:p></span></div>
<div class="MsoListParagraph">
<span style="font-family: "georgia" , "times new roman" , serif;"><br /></span></div>
<div class="MsoListParagraph">
<span style="font-family: "georgia" , "times new roman" , serif;">Start Login by command prompt, Go to the directory
where you have published your source code (make sure this folder has all
required files to run the app, including “.yml” file</span><o:p></o:p></div>
<div class="MsoNormal" style="margin-left: .5in;">
<span style="color: blue; font-family: "georgia" , "times new roman" , serif;"><br /></span></div>
<div class="MsoNormal" style="margin-left: .5in;">
<span style="color: blue; font-family: "georgia" , "times new roman" , serif;">C:\Ritesh\ WebAPIPublish> cf
login -a </span><a href="https://api.run.pivotal.io/" style="font-family: georgia, "times new roman", serif; text-indent: 24px;">https://api.run.pivotal.io/</a></div>
<div class="MsoNormal" style="margin-left: .5in;">
<span style="color: blue; font-family: "georgia" , "times new roman" , serif;">Email> <a href="mailto:Riteshkk2005@gmail.com">UserId</a><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-left: .5in;">
<span style="color: blue; font-family: "georgia" , "times new roman" , serif;">Password> Password<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-left: .5in;">
<span style="color: blue; font-family: "georgia" , "times new roman" , serif;">Space> 1 // if multiple space available, you need to choose desire space</span><o:p></o:p></div>
<div class="MsoListParagraph">
<br /></div>
<div class="MsoListParagraph">
<span style="font-family: "georgia" , "times new roman" , serif;">Now you are ready to start the deployment<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-left: 0.5in; text-align: left;">
<span style="color: blue;"><span style="font-family: "georgia" , "times new roman" , serif;">C:\Ritesh\WebAPIPublish></span> cf push</span></div>
<div class="MsoNormal" style="margin-left: .5in;">
<span style="font-family: "georgia" , "times new roman" , serif;"><br /></span></div>
<div class="MsoNormal" style="margin-left: .5in;">
<span style="font-family: "georgia" , "times new roman" , serif;">If error pops up go and see the log</span></div>
<div class="MsoNormal" style="margin-left: .5in;">
<o:p></o:p></div>
<div class="MsoNormal" style="margin-left: .5in;">
<span style="color: blue;"><span style="font-family: "georgia" , "times new roman" , serif;">C:\Ritesh\WebAPIPublish></span> cf log <app name=""><space name=""> - recent</space></app></span><o:p></o:p></div>
<div class="MsoNormal" style="margin-left: .5in;">
<span style="font-family: "georgia" , "times new roman" , serif;"><br /></span></div>
<div class="MsoNormal" style="margin-left: .5in;">
<span style="font-family: "georgia" , "times new roman" , serif;">If log shows that health check fail
than turn off health check up</span><o:p></o:p></div>
<div class="MsoNormal" style="margin-left: .5in;">
<span style="color: blue;"><span style="font-family: "georgia" , "times new roman" , serif;">C:\Ritesh\WebAPIPublish></span> cf push
--health-check-type=none</span><o:p></o:p></div>
<div class="MsoNormal" style="margin-left: .5in;">
<span style="font-family: "georgia" , "times new roman" , serif;"><br /></span></div>
<div class="MsoNormal" style="margin-left: .5in;">
<span style="font-family: "georgia" , "times new roman" , serif;">Let’s wait till you see application
started message</span><o:p></o:p></div>
<div class="MsoNormal" style="margin-left: .5in;">
<span style="color: blue;">1 of 1 instance running<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-left: .5in;">
<span style="color: blue;">OK</span><o:p></o:p></div>
<div class="MsoListParagraph">
<span style="font-family: "georgia" , "times new roman" , serif;"><br /></span></div>
<div class="MsoListParagraph">
<span style="font-family: "georgia" , "times new roman" , serif;">After successfully deployed you can login online and
get the URL and you can use it to access your app like: </span><span style="color: windowtext;"><a href="https://riteshwebapi.cfapps.io/">https://riteshwebapi.cfapps.io</a></span><br />
<br />
References:<br />
<a href="https://pivotal.io/platform/pcf-tutorials/getting-started-with-pivotal-cloud-foundry/deploy-the-sample-app">https://pivotal.io/platform/pcf-tutorials/getting-started-with-pivotal-cloud-foundry/deploy-the-sample-app</a><br />
<a href="https://pivotal.io/platform">https://pivotal.io/platform</a></div>
</div>
</div>
</div>
Ritesh_Kesharwanihttp://www.blogger.com/profile/06191918659869264896noreply@blogger.com7tag:blogger.com,1999:blog-7638493.post-6000486663558376672017-04-20T11:19:00.001-07:002017-06-08T13:01:13.033-07:00Best way to understand Bubble sort and Insertion Sort Algorithm <div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: left;">
<b><u>Bubble Sort </u></b></div>
<div class="separator" style="clear: both; text-align: left;">
<b><u><br /></u></b></div>
<div class="separator" style="clear: both; text-align: left;">
Below image will describe how bubble sort code work when code execute in loop, below pictures are self explanatory for algorithm steps. </div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-an0Y_OAU8kg/WOacs9HJY_I/AAAAAAAARHg/PdPy0kDV_oYeTOlFAQDJiisxfiV0WZx0ACLcB/s1600/BubbleSort.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="120" src="https://1.bp.blogspot.com/-an0Y_OAU8kg/WOacs9HJY_I/AAAAAAAARHg/PdPy0kDV_oYeTOlFAQDJiisxfiV0WZx0ACLcB/s640/BubbleSort.gif" width="640" /></a></div>
<span style="color: blue;"><b><u>C# Code</u></b></span><br />
<span style="color: blue;">public int[] BubbleSort(int[] val)</span><br />
<span style="color: blue;">{</span><br />
<span style="color: blue;"> bool flag = true;</span><br />
<span style="color: blue;"> int temp;</span><br />
<span style="color: blue;"><br /></span>
<span style="color: blue;"> for (int i =0;(i<=val.Count()-1) && flag; i++)</span><br />
<span style="color: blue;"> {</span><br />
<span style="color: blue;"> flag = false;</span><br />
<span style="color: blue;"> for (int j = 0; j < val.Count()-1; j++)</span><br />
<span style="color: blue;"> {</span><br />
<span style="color: blue;"> if (val[j + 1] < val[j])</span><br />
<span style="color: blue;"> {</span><br />
<span style="color: blue;"> temp = val[j + 1];</span><br />
<span style="color: blue;"> val[j + 1] = val[j];</span><br />
<span style="color: blue;"> val[j] = temp;</span><br />
<span style="color: blue;"> flag = true;</span><br />
<span style="color: blue;"> }</span><br />
<span style="color: blue;"> }</span><br />
<span style="color: blue;"> }</span><br />
<span style="color: blue;"> return val;</span><br />
<span style="color: blue;">}</span><br />
<u><b><br /></b></u>
<u><b>Insertion Sort</b></u><br />
<u><b><br /></b></u>
Faster than bubble sort<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-XgQGXmcxBNI/WOacs5EurwI/AAAAAAAARHc/_Buin65MZAwXUCsba2mrRAqeCZmB7_Q4QCLcB/s1600/InsertionSort.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="120" src="https://1.bp.blogspot.com/-XgQGXmcxBNI/WOacs5EurwI/AAAAAAAARHc/_Buin65MZAwXUCsba2mrRAqeCZmB7_Q4QCLcB/s640/InsertionSort.gif" width="640" /></a></div>
<b style="color: blue;"><u>C# Code</u></b><br />
<span style="color: blue;">public int[] InsertionSort(int[] val)</span><br />
<span style="color: blue;">{</span><br />
<span style="color: blue;"> for (int i = 0; i <= val.Count(); i++)</span><br />
<span style="color: blue;"> {</span><br />
<span style="color: blue;"> int temp = val[i];</span><br />
<span style="color: blue;"> int j = i - 1;</span><br />
<span style="color: blue;"><br /></span>
<span style="color: blue;"> while (j >= 0 && val[j] < temp)</span><br />
<span style="color: blue;"> {</span><br />
<span style="color: blue;"> val[j + 1] = val[j];</span><br />
<span style="color: blue;"> j--;</span><br />
<span style="color: blue;"> }</span><br />
<span style="color: blue;"> val[j + 1] = temp;</span><br />
<span style="color: blue;"> }</span><br />
<span style="color: blue;"> return val;</span><br />
<span style="color: blue;">}</span></div>
Ritesh_Kesharwanihttp://www.blogger.com/profile/06191918659869264896noreply@blogger.com0tag:blogger.com,1999:blog-7638493.post-51045723428051829242017-04-20T11:03:00.000-07:002017-06-08T13:00:50.099-07:00.NET Core Error: /Core and /WepApp.deps.json could not be found<div dir="ltr" style="text-align: left;" trbidi="on">
When I tried to run my first .NET Core web application, I found wired issues and it took me longer time to figure out, what is actual issues was, error message was not helping at all to find out the solution<br />
<br />
<b><u>.NET Core Error:</u></b> <span style="color: red;"><<<b>Project Dir Path</b>>>/Core and <<<b>Project Dir Path</b>>>/WepApp.deps.json could not be found</span><br />
<br />
To find out the solution, I started couple of times from scratch and finally I tried with different directory and file name to save my .NET Core project.<br />
<br />
<b><u>Issues:</u></b><br />
Previous Project Path was: <span style="color: red;">C:\Ritesh\NET Core\Core WebAPP</span><br />
<br />
<b><u>Solution:</u></b><br />
Later Project Path (works): <span style="background-color: lime;">C:\Ritesh\NETCore\CoreWebApp</span> (NO SPACE in dir name and file name)<br />
<br />
It's works for me, I don't know this is the really solution or Microsoft need to release some patch to fix this.<br />
<br /></div>
Ritesh_Kesharwanihttp://www.blogger.com/profile/06191918659869264896noreply@blogger.com0tag:blogger.com,1999:blog-7638493.post-73033959749163607492017-03-10T07:14:00.001-08:002017-03-10T07:14:58.104-08:00Parameters needs to be considered before choosing REST or SOAP<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="MsoNormal">
There are many parameter needs to be considered before
choosing REST or SOAP like <o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<b>Performance & Scalability<o:p></o:p></b></div>
<div class="MsoNormal">
</div>
<ul style="text-align: left;">
<li>REST has better Performance and Scalability features. Read
operation in REST can be cached whereas SOAP based read cannot be cached.</li>
<li>REST service is good when we have limited bandwidth and have
requirement to accomplish by simple CRUD based operation.</li>
</ul>
<b>Security</b><o:p></o:p><br />
<div class="MsoNormal">
</div>
<ul style="text-align: left;">
<li>Provide more choice for implementing security beyond the
standard SSL support by implementing WS-Security standard</li>
</ul>
<b>Transaction Support</b><o:p></o:p><br />
<div class="MsoNormal">
</div>
<ul style="text-align: left;">
<li>SOAP can support distributed two-phase commit transactions
by implementing WS-Atomic standards.</li>
<li>REST does not support transaction</li>
</ul>
<b>Extended Client
Support</b><o:p></o:p><br />
<div class="MsoNormal">
</div>
<ul style="text-align: left;">
<li>REST allow better support for browser and mobile clients due
to its support for JSON.</li>
</ul>
<b>Extended Data Format
Support</b><o:p></o:p><br />
<div class="MsoNormal">
</div>
<ul style="text-align: left;">
<li>REST allows many data format like JSON, XML, Text, SOAP only
support XML which require more bandwidth to pass data through wire</li>
</ul>
<b>Multiple Protocol
Support</b><o:p></o:p><br />
<div class="MsoNormal">
</div>
<ul style="text-align: left;">
<li>SOAP service can use any transport protocol such as HTTP,
HTTPS, TCP, SMTP, and MSMQ. REST only support standard HTTP and it is much
easier to implement, simple methods to call GET, PUT, POST and DELETE.</li>
</ul>
<b>Error Handling</b><o:p></o:p><br />
<div class="MsoNormal">
</div>
<ul style="text-align: left;">
<li>REST support standard HTTP error handling but SOAP provide
more robust error handling including user define error handling.</li>
</ul>
<div>
<b><u>Summary</u></b></div>
<div>
<br /></div>
<table border="1" cellpadding="0" cellspacing="0" class="MsoTableGrid" style="border-collapse: collapse; border: none; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 0in 5.4pt 0in 5.4pt; mso-yfti-tbllook: 1184;">
<tbody>
<tr>
<td style="background: black; border: solid windowtext 1.0pt; mso-background-themecolor: text1; mso-border-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 239.4pt;" valign="top" width="319"><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;">
<b><span style="font-size: 12.0pt; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="color: white;"> REST</span><o:p></o:p></span></b></div>
</td>
<td style="background: black; border-left: none; border: solid windowtext 1.0pt; mso-background-themecolor: text1; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 239.4pt;" valign="top" width="319"><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;">
<b><span style="font-size: 12.0pt; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="color: white;"> SOAP</span><o:p></o:p></span></b></div>
</td>
</tr>
<tr>
<td style="border-top: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 239.4pt;" valign="top" width="319"><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;">
<span style="font-family: Georgia, Times New Roman, serif; font-size: 12.0pt; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;">Expose the data<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 239.4pt;" valign="top" width="319"><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;">
<span style="font-family: Georgia, Times New Roman, serif; font-size: 12.0pt; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;">Expose the logic<o:p></o:p></span></div>
</td>
</tr>
<tr>
<td style="border-top: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 239.4pt;" valign="top" width="319"><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;">
<span style="font-family: Georgia, Times New Roman, serif; font-size: 12.0pt; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;">Support multiple Data format, JSON, XML,
HTML, Text etc.<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 239.4pt;" valign="top" width="319"><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;">
<span style="font-family: Georgia, Times New Roman, serif; font-size: 12.0pt; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;">Support only XML<o:p></o:p></span></div>
</td>
</tr>
<tr>
<td style="border-top: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 239.4pt;" valign="top" width="319"><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;">
<span style="font-family: Georgia, Times New Roman, serif; font-size: 12.0pt; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;">Support only Http, Https protocol<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 239.4pt;" valign="top" width="319"><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;">
<span style="font-family: Georgia, Times New Roman, serif; font-size: 12.0pt; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;">Support multiple protocol; Http, Https, TCP,
UDP SMTP, Messaging etc. <o:p></o:p></span></div>
</td>
</tr>
<tr>
<td style="border-top: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 239.4pt;" valign="top" width="319"><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;">
<span style="font-family: Georgia, Times New Roman, serif; font-size: 12.0pt; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;">Support for Transaction Management but not
ACID compliance or two-phase commit transaction.<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 239.4pt;" valign="top" width="319"><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;">
<span style="font-family: Georgia, Times New Roman, serif;"><span style="font-size: 12.0pt; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;">Better support for transaction management </span>Support, ACID and two-phase commit transaction
by implementing WS-Atomic Standard</span></div>
</td>
</tr>
<tr>
<td style="border-top: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 239.4pt;" valign="top" width="319"><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;">
<span style="font-family: Georgia, Times New Roman, serif; font-size: 12.0pt; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;">Need less band width<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 239.4pt;" valign="top" width="319"><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;">
<span style="font-family: Georgia, Times New Roman, serif; font-size: 12.0pt; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;">Need more band width because of XML<o:p></o:p></span></div>
</td>
</tr>
<tr>
<td style="border-top: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 239.4pt;" valign="top" width="319"><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;">
<span style="font-family: Georgia, Times New Roman, serif; font-size: 12.0pt; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;">Suited for stateless CRUD operations<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 239.4pt;" valign="top" width="319"><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;">
<span style="font-family: Georgia, Times New Roman, serif; font-size: 12.0pt; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;">Suited for Stateful operation, Easy to
configure session support<o:p></o:p></span></div>
</td>
</tr>
<tr>
<td style="border-top: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 239.4pt;" valign="top" width="319"><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;">
<span style="font-family: Georgia, Times New Roman, serif; font-size: 12.0pt; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;">Less support for Security<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;">
<span style="font-family: Georgia, Times New Roman, serif; font-size: 12.0pt; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;">Supports only
point-to-point SSL security. The SSL encrypts the whole message, whether all
of it is sensitive or not.<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 239.4pt;" valign="top" width="319"><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;">
<span style="font-family: Georgia, Times New Roman, serif;"><span style="font-size: 12.0pt; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;">SOAP WS has Better support for Security </span>Both SSL security and
WS-security</span></div>
</td>
</tr>
<tr>
<td style="border-top: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 239.4pt;" valign="top" width="319"><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;">
<span style="font-family: Georgia, Times New Roman, serif; font-size: 12.0pt; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;">Better Support for browsers and mobile
client, Because of Lightweight<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 239.4pt;" valign="top" width="319"><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;">
<span style="font-family: Georgia, Times New Roman, serif; font-size: 12.0pt; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;">Limited browser support<o:p></o:p></span></div>
</td>
</tr>
<tr>
<td style="border-top: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 239.4pt;" valign="top" width="319"><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;">
<span style="font-family: Georgia, Times New Roman, serif; font-size: 12.0pt; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;">Read operation can be cached<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 239.4pt;" valign="top" width="319"><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;">
<span style="font-family: Georgia, Times New Roman, serif; font-size: 12.0pt; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;">Read Operation cannot be cached<o:p></o:p></span></div>
</td>
</tr>
<tr>
<td style="border-top: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 239.4pt;" valign="top" width="319"><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;">
<span style="font-family: Georgia, Times New Roman, serif; font-size: 12.0pt; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;">Support for better performance and scalability
<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 239.4pt;" valign="top" width="319"><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;">
<span style="font-family: Georgia, Times New Roman, serif; font-size: 12.0pt; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;">Performance is less as compare to REST<o:p></o:p></span></div>
</td>
</tr>
<tr>
<td style="border-top: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 239.4pt;" valign="top" width="319"><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;">
<span style="font-family: Georgia, Times New Roman, serif; font-size: 12.0pt; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;">Support only HTTP error Handling<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 239.4pt;" valign="top" width="319"><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;">
<span style="font-family: Georgia, Times New Roman, serif; font-size: 12.0pt; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;">Support robust error handling including user
define error handling<o:p></o:p></span></div>
</td>
</tr>
<tr>
<td style="border-top: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 239.4pt;" valign="top" width="319"><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;">
<span style="font-family: Georgia, Times New Roman, serif; font-size: 12.0pt; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;">Only support Synchronous message<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 239.4pt;" valign="top" width="319"><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;">
<span style="font-size: 12.0pt; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="font-family: Georgia, Times New Roman, serif;">Can support Synchronous and Asynchronous
both messages</span><o:p></o:p></span></div>
</td>
</tr>
</tbody></table>
</div>
Ritesh_Kesharwanihttp://www.blogger.com/profile/06191918659869264896noreply@blogger.com0tag:blogger.com,1999:blog-7638493.post-38140866187369651802017-02-02T10:24:00.000-08:002017-02-02T10:24:00.744-08:00WCF Security, When/How to Use, Advantages and Disadvantages<div dir="ltr" style="text-align: left;" trbidi="on">
<table border="1" cellpadding="0" cellspacing="0" class="MsoTableGrid" style="border-collapse: collapse; border: none; margin-left: .00in; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 0in 5.4pt 0in 5.4pt; mso-yfti-tbllook: 1184; width: 650px;">
<tbody>
<tr>
<td style="border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 279.0pt;" valign="top" width="372"><div class="MsoNormal" style="line-height: 13.5pt; margin-bottom: .0001pt; margin-bottom: 0in;">
<b><i><span style="color: #2a2a2a; font-family: "segoe ui" , sans-serif; font-size: 10.0pt;">Transport Security</span></i></b><b><span style="color: #2a2a2a; font-family: "segoe ui" , sans-serif; font-size: 10.0pt;"><o:p></o:p></span></b></div>
</td>
<td style="border-left: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 279.0pt;" valign="top" width="372"><div class="MsoNormal" style="line-height: 13.5pt; margin-bottom: .0001pt; margin-bottom: 0in;">
<b><i><span style="color: #2a2a2a; font-family: "segoe ui" , sans-serif; font-size: 10.0pt;">Message Security</span></i></b><span style="color: #2a2a2a; font-family: "segoe ui" , sans-serif; font-size: 10.0pt;"><o:p></o:p></span></div>
</td>
</tr>
<tr>
<td style="border-top: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 279.0pt;" valign="top" width="372"><div class="MsoNormal" style="line-height: 13.5pt; margin-bottom: .0001pt; margin-bottom: 0in;">
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="color: #2a2a2a; font-size: 10.0pt;">When using transport security, the user credentials and claims
are passed by using the transport layer. In other words, user credentials are
transport-dependent, which allows fewer authentication options compared to
message security. Each transport protocol (TCP, IPC, MSMQ, or HTTP) has its
own mechanism for passing credentials and handling message protection. The
most common approach for this is to use Secure Sockets Layer (SSL) for
encrypting and signing the contents of the packets sent over Secure HTTP
(HTTPS).</span><b><span style="color: #2a2a2a; font-size: 10.0pt;"><o:p></o:p></span></b></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 279.0pt;" valign="top" width="372"><div class="MsoNormal" style="line-height: 13.5pt; margin-bottom: .0001pt; margin-bottom: 0in;">
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="color: #2a2a2a; font-size: 10.0pt;">When using</span><span class="apple-converted-space"><span style="color: #2a2a2a; font-size: 10.0pt;"> </span></span><em><span style="color: #2a2a2a; font-size: 10.0pt;">message security</span></em><span style="color: #2a2a2a; font-size: 10.0pt;">,
the user credentials and claims are encapsulated in every message using the
WS-Security specification to secure messages. This option gives the most
flexibility from an authentication perspective. You can use any type of
security credentials you want, largely independent of transport, as long as
both the client and service agree.</span></span><b><span style="color: #2a2a2a; font-family: "segoe ui" , sans-serif; font-size: 10.0pt;"><o:p></o:p></span></b></div>
</td>
</tr>
<tr style="height: 115.6pt; mso-yfti-irow: 2;">
<td style="border-top: none; border: solid windowtext 1.0pt; height: 115.6pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 279.0pt;" valign="top" width="372"><div class="MsoNormal" style="line-height: 13.5pt; margin-bottom: .0001pt; margin-bottom: 0in;">
<b><span style="color: #2a2a2a; font-family: Arial, Helvetica, sans-serif; font-size: 10.0pt;">Use<o:p></o:p></span></b></div>
<ul type="disc">
<li class="MsoNormal" style="line-height: 13.15pt;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: 10.0pt;">You are sending a message directly from your
application to a WCF service and the message will <b>not</b> be routed through intermediate systems.<o:p></o:p></span></li>
<li class="MsoNormal" style="color: #2a2a2a; line-height: 13.15pt; mso-list: l2 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-family: Arial, Helvetica, sans-serif;"><span style="color: black; font-size: 10.0pt;">Both the service and the client are
located in an intranet.</span><b><span style="font-size: 10.0pt;"><o:p></o:p></span></b></span></li>
</ul>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 115.6pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 279.0pt;" valign="top" width="372"><div class="MsoNormal" style="line-height: 13.5pt; margin-bottom: .0001pt; margin-bottom: 0in;">
<b><span style="color: #2a2a2a; font-family: Arial, Helvetica, sans-serif; font-size: 10.0pt;">Use<o:p></o:p></span></b></div>
<ul type="disc">
<li class="MsoNormal" style="line-height: 13.15pt;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: 10.0pt;">You are sending a message to a WCF service, and the
message is likely to be forwarded to other WCF services or may be routed
through intermediate systems.<o:p></o:p></span></li>
<li class="MsoNormal" style="color: #2a2a2a; line-height: 13.15pt; mso-list: l1 level1 lfo4; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-family: Arial, Helvetica, sans-serif;"><span style="color: black; font-size: 10.0pt;">Your WCF clients are accessing the WCF
service over the Internet and messages may be routed through
intermediate systems.</span><b><span style="font-size: 10.0pt;"><o:p></o:p></span></b></span></li>
</ul>
</td>
</tr>
<tr style="height: 174.1pt; mso-yfti-irow: 3;">
<td style="border-top: none; border: solid windowtext 1.0pt; height: 174.1pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 279.0pt;" valign="top" width="372"><div class="MsoNormal" style="line-height: 13.5pt; margin-bottom: .0001pt; margin-bottom: 0in;">
<b><span style="color: #2a2a2a; font-family: Arial, Helvetica, sans-serif; font-size: 10.0pt;">Advantage<o:p></o:p></span></b></div>
<ul type="disc">
<li class="MsoNormal" style="line-height: 13.15pt;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: 10.0pt;">It provides interoperability, meaning that
communicating parties do not need to understand WS-Security
specifications.<o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: 13.15pt;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: 10.0pt;">It may result in better performance.<o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: 13.15pt;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: 10.0pt;">Hardware accelerators can be used to further improve
the performance.<o:p></o:p></span></li>
</ul>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 174.1pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 279.0pt;" valign="top" width="372"><div class="MsoNormal" style="line-height: 13.5pt; margin-bottom: .0001pt; margin-bottom: 0in;">
<b><span style="color: #2a2a2a; font-family: Arial, Helvetica, sans-serif; font-size: 10.0pt;">Advantage<o:p></o:p></span></b></div>
<ul type="disc">
<li class="MsoNormal" style="line-height: 13.15pt;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: 10.0pt;">It provides end-to-end security. Because message
security directly encrypts and signs the message, having intermediaries
does not break the security.<o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: 13.15pt;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: 10.0pt;">It allows partial or selective message encryption and
signing, thus improving overall application performance.<o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: 13.15pt;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: 10.0pt;">Message security is transport-independent and
therefore can be used with any transport protocol.<o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: 13.15pt;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: 10.0pt;">It supports a wide set of credentials and claims,
including the issue token that enables federated security.<o:p></o:p></span></li>
</ul>
</td>
</tr>
<tr style="height: 135.85pt; mso-yfti-irow: 4;">
<td style="border-top: none; border: solid windowtext 1.0pt; height: 135.85pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 279.0pt;" valign="top" width="372"><div class="MsoNormal" style="line-height: 13.5pt; margin-bottom: .0001pt; margin-bottom: 0in;">
<b><span style="color: #2a2a2a; font-family: Arial, Helvetica, sans-serif; font-size: 10.0pt;">Dis Advantage<o:p></o:p></span></b></div>
<ul type="disc">
<li class="MsoNormal" style="line-height: 13.15pt;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: 10.0pt;">Security is applied on a point-to-point basis, with
no provision for multiple hops or routing through intermediate
application nodes.<o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: 13.15pt;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: 10.0pt;">It supports a limited set of credentials and claims
compared to message security.<o:p></o:p></span></li>
<li class="MsoNormal" style="color: #2a2a2a; line-height: 13.15pt; mso-list: l0 level1 lfo3; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-family: Arial, Helvetica, sans-serif;"><span style="color: black; font-size: 10.0pt;">It is transport-dependent upon the
underlying platform, transport mechanism, and security service provider,
such as NTLM or Kerberos.</span><b><span style="font-size: 10.0pt;"><o:p></o:p></span></b></span></li>
</ul>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 135.85pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 279.0pt;" valign="top" width="372"><div class="MsoNormal" style="line-height: 13.5pt; margin-bottom: .0001pt; margin-bottom: 0in;">
<b><span style="color: #2a2a2a; font-family: Arial, Helvetica, sans-serif; font-size: 10.0pt;">Dis Advantage<o:p></o:p></span></b></div>
<ul type="disc">
<li class="MsoNormal" style="line-height: 13.15pt;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: 10.0pt;">This option may reduce performance compared to
transport security because each individual message is encrypted and
signed.<o:p></o:p></span></li>
<li class="MsoNormal" style="color: #2a2a2a; line-height: 13.15pt; mso-list: l5 level1 lfo6; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="color: black; font-family: Arial, Helvetica, sans-serif; font-size: 10.0pt;">It does not support interoperability with
older ASMX clients, as it requires both the client and service to
support WS-Security specifications.</span><b><span style="font-family: "segoe ui" , sans-serif; font-size: 10.0pt;"><o:p></o:p></span></b></li>
</ul>
</td>
</tr>
<tr style="height: 49.0pt; mso-yfti-irow: 5; mso-yfti-lastrow: yes;">
<td style="background: white; border-top: none; border: solid windowtext 1.0pt; height: 49.0pt; mso-background-themecolor: background1; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 279.0pt;" valign="top" width="372"><div style="border: solid #FBEDBB 1.0pt; mso-border-alt: solid #FBEDBB .75pt; mso-element: para-border-div; padding: 5.0pt 5.0pt 5.0pt 5.0pt;">
<div class="MsoNormal" style="border: none; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-border-alt: solid #FBEDBB .75pt; mso-padding-alt: 5.0pt 5.0pt 5.0pt 5.0pt; padding: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: blue; font-family: "consolas"; font-size: 8.0pt;"><</span><span style="color: maroon; font-family: "consolas"; font-size: 8.0pt;">netTcpBinding</span><span style="color: blue; font-family: "consolas"; font-size: 8.0pt;">></span><span style="font-family: "consolas"; font-size: 8pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: normal; margin-bottom: 0.0001pt; padding: 0in;">
<span style="color: blue; font-family: "consolas"; font-size: 8.0pt;"><</span><span style="color: maroon; font-family: "consolas"; font-size: 8.0pt;">binding</span><span style="font-family: "consolas"; font-size: 8pt;"> </span><span style="color: red; font-family: "consolas"; font-size: 8.0pt;">name</span><span style="color: blue; font-family: "consolas"; font-size: 8.0pt;">="netTcpTransportBinding"></span><span style="font-family: "consolas"; font-size: 8pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: normal; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: "consolas"; font-size: 8pt;"> </span><span style="color: blue; font-family: "consolas"; font-size: 8.0pt;"><</span><span style="color: maroon; font-family: "consolas"; font-size: 8.0pt;">security</span><span style="font-family: "consolas"; font-size: 8pt;"> </span><span style="color: red; font-family: "consolas"; font-size: 8.0pt;">mode</span><span style="color: blue; font-family: "consolas"; font-size: 8.0pt;">="Transport"></span><span style="font-family: "consolas"; font-size: 8pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: normal; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: "consolas"; font-size: 8pt;"> </span><span style="color: blue; font-family: "consolas"; font-size: 8.0pt;"><</span><span style="color: maroon; font-family: "consolas"; font-size: 8.0pt;">Transport</span><span style="font-family: "consolas"; font-size: 8pt;"> </span><span style="color: red; font-family: "consolas"; font-size: 8.0pt;">clientCredentialType</span><span style="color: blue; font-family: "consolas"; font-size: 8.0pt;">="Windows"</span><span style="font-family: "consolas"; font-size: 8pt;"> </span><span style="color: blue; font-family: "consolas"; font-size: 8.0pt;">/></span><span style="font-family: "consolas"; font-size: 8pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: normal; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: "consolas"; font-size: 8pt;"> </span><span style="color: blue; font-family: "consolas"; font-size: 8.0pt;"><</span><span style="color: maroon; font-family: "consolas"; font-size: 8.0pt;">/security</span><span style="color: blue; font-family: "consolas"; font-size: 8.0pt;">></span><span style="font-family: "consolas"; font-size: 8pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: normal; margin-bottom: 0.0001pt; padding: 0in;">
<span style="color: blue; font-family: "consolas"; font-size: 8.0pt;"><</span><span style="color: maroon; font-family: "consolas"; font-size: 8.0pt;">/binding</span><span style="color: blue; font-family: "consolas"; font-size: 8.0pt;">></span><span style="font-family: "consolas"; font-size: 8pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: normal; margin-bottom: 0.0001pt; padding: 0in;">
<span style="color: blue; font-family: "consolas"; font-size: 8.0pt;"><</span><span style="color: maroon; font-family: "consolas"; font-size: 8.0pt;">/netTcpBinding</span><span style="color: blue; font-family: "consolas"; font-size: 8.0pt;">></span><span style="font-family: "consolas"; font-size: 8pt;"><o:p></o:p></span></div>
</div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 49.0pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 279.0pt;" valign="top" width="372"><div style="border: solid #FBEDBB 1.0pt; mso-border-alt: solid #FBEDBB .75pt; mso-element: para-border-div; padding: 5.0pt 5.0pt 5.0pt 5.0pt;">
<div class="MsoNormal" style="border: none; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-border-alt: solid #FBEDBB .75pt; mso-padding-alt: 5.0pt 5.0pt 5.0pt 5.0pt; padding: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: blue; font-family: "consolas"; font-size: 8.0pt;"><</span><span style="color: maroon; font-family: "consolas"; font-size: 8.0pt;">wsHttpBinding</span><span style="color: blue; font-family: "consolas"; font-size: 8.0pt;">></span><span style="font-family: "consolas"; font-size: 8pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="border: none; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-border-alt: solid #FBEDBB .75pt; mso-padding-alt: 5.0pt 5.0pt 5.0pt 5.0pt; padding: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: blue; font-family: "consolas"; font-size: 8.0pt;"><</span><span style="color: maroon; font-family: "consolas"; font-size: 8.0pt;">binding</span><span style="font-family: "consolas"; font-size: 8pt;"> </span><span style="color: red; font-family: "consolas"; font-size: 8.0pt;">name</span><span style="color: blue; font-family: "consolas"; font-size: 8.0pt;">="wsHttpMessageBinding"></span><span style="font-family: "consolas"; font-size: 8pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="border: none; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-border-alt: solid #FBEDBB .75pt; mso-padding-alt: 5.0pt 5.0pt 5.0pt 5.0pt; padding: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "consolas"; font-size: 8pt;"> </span><span style="color: blue; font-family: "consolas"; font-size: 8.0pt;"><</span><span style="color: maroon; font-family: "consolas"; font-size: 8.0pt;">security</span><span style="font-family: "consolas"; font-size: 8pt;"> </span><span style="color: red; font-family: "consolas"; font-size: 8.0pt;">mode</span><span style="color: blue; font-family: "consolas"; font-size: 8.0pt;">="Message"></span><span style="font-family: "consolas"; font-size: 8pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="border: none; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-border-alt: solid #FBEDBB .75pt; mso-padding-alt: 5.0pt 5.0pt 5.0pt 5.0pt; padding: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "consolas"; font-size: 8pt;"> </span><span style="color: blue; font-family: "consolas"; font-size: 8.0pt;"><</span><span style="color: maroon; font-family: "consolas"; font-size: 8.0pt;">Message</span><span style="font-family: "consolas"; font-size: 8pt;"> </span><span style="color: red; font-family: "consolas"; font-size: 8.0pt;">clientCredentialType</span><span style="color: blue; font-family: "consolas"; font-size: 8.0pt;">="UserName"</span><span style="font-family: "consolas"; font-size: 8pt;"> </span><span style="color: blue; font-family: "consolas"; font-size: 8.0pt;">/></span><span style="font-family: "consolas"; font-size: 8pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="border: none; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-border-alt: solid #FBEDBB .75pt; mso-padding-alt: 5.0pt 5.0pt 5.0pt 5.0pt; padding: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "consolas"; font-size: 8pt;"> </span><span style="color: blue; font-family: "consolas"; font-size: 8.0pt;"><</span><span style="color: maroon; font-family: "consolas"; font-size: 8.0pt;">/security</span><span style="color: blue; font-family: "consolas"; font-size: 8.0pt;">></span><span style="font-family: "consolas"; font-size: 8pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="border: none; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-border-alt: solid #FBEDBB .75pt; mso-padding-alt: 5.0pt 5.0pt 5.0pt 5.0pt; padding: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "consolas"; font-size: 8pt;"> </span><span style="color: blue; font-family: "consolas"; font-size: 8.0pt;"><</span><span style="color: maroon; font-family: "consolas"; font-size: 8.0pt;">/binding</span><span style="color: blue; font-family: "consolas"; font-size: 8.0pt;">></span><span style="font-family: "consolas"; font-size: 8pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="border: none; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-border-alt: solid #FBEDBB .75pt; mso-padding-alt: 5.0pt 5.0pt 5.0pt 5.0pt; padding: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: blue; font-family: "consolas"; font-size: 8.0pt;"><</span><span style="color: maroon; font-family: "consolas"; font-size: 8.0pt;">/wsHttpBinding</span><span style="color: blue; font-family: "consolas"; font-size: 8.0pt;">><o:p></o:p></span></div>
</div>
</td>
</tr>
</tbody></table>
</div>
Ritesh_Kesharwanihttp://www.blogger.com/profile/06191918659869264896noreply@blogger.com1tag:blogger.com,1999:blog-7638493.post-32075099722714554032016-10-28T12:02:00.004-07:002017-02-10T13:25:30.512-08:00Quick coding excersice to learn Angular <div dir="ltr" style="text-align: left;" trbidi="on">
I have created one simple user interface with MVC Controller to understand AngularJS directive, controller, module, GET and PUT method. This will help at beginner level, one single code will let you know many things.<br />
<br />
<b><u><span style="color: #cc0000;">User Interface Code</span></u></b><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-ruEu6GRuJcc/WBOgPbxcwsI/AAAAAAAANYQ/33qZk2cgL3M8qAz_I32fc-C-mDu2hsuOQCLcB/s1600/Angular-UI.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://1.bp.blogspot.com/-ruEu6GRuJcc/WBOgPbxcwsI/AAAAAAAANYQ/33qZk2cgL3M8qAz_I32fc-C-mDu2hsuOQCLcB/s1600/Angular-UI.png" /></a></div>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<b><u><span style="color: #cc0000;">MVC C#.NET Controller Code</span></u></b><br />
<br />
<span style="color: blue;">namespace AngularTutorial.Controllers</span><br />
<span style="color: blue;">{</span><br />
<span style="color: blue;"> public class Emp</span><br />
<span style="color: blue;"> {</span><br />
<span style="color: blue;"> public string Name {get; set;}</span><br />
<span style="color: blue;"> public string City {get; set;}</span><br />
<span style="color: blue;"> }</span><br />
<span style="color: blue;"><br /></span>
<span style="color: blue;"> public class AngularController : Controller</span><br />
<span style="color: blue;"> {</span><br />
<span style="color: blue;"> public ActionResult Angular()</span><br />
<span style="color: blue;"> {</span><br />
<span style="color: blue;"> return View();</span><br />
<span style="color: blue;"> }</span><br />
<span style="color: blue;"><br /></span>
<span style="color: blue;"> [HttpGet]</span><br />
<span style="color: blue;"> public JsonResult GetEmpData()</span><br />
<span style="color: blue;"> {</span><br />
<span style="color: blue;"> List<emp> empList = new List<emp>();</emp></emp></span><br />
<span style="color: blue;"><br /></span>
<span style="color: blue;"> for (int i = 0; i <= 5; i++)</span><br />
<span style="color: blue;"> {</span><br />
<span style="color: blue;"> Emp emp = new Emp();</span><br />
<span style="color: blue;"> emp.Name = "Ritesh - " + i;</span><br />
<span style="color: blue;"> emp.City = "Jbp - " + i*i;</span><br />
<span style="color: blue;"> empList.Add(emp);</span><br />
<span style="color: blue;"> }</span><br />
<span style="color: blue;"> return Json(empList, JsonRequestBehavior.AllowGet);</span><br />
<span style="color: blue;"> }</span><br />
<span style="color: blue;"><br /></span>
<span style="color: blue;"> [HttpPost]</span><br />
<span style="color: blue;"> public ActionResult Employee(Emp emp)</span><br />
<span style="color: blue;"> {</span><br />
<span style="color: blue;"> if (ModelState.IsValid)</span><br />
<span style="color: blue;"> {</span><br />
<span style="color: blue;"> // Add data insert/update logic here</span><br />
<span style="color: blue;"> }</span><br />
<span style="color: blue;"> return View();</span><br />
<span style="color: blue;"> }</span><br />
<span style="color: blue;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="color: blue;">}</span><br />
<b><u><br /></u></b>
<b><u><span style="color: #cc0000;">User Interface Run time</span></u></b><br />
<b><u><br /></u></b>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<a href="https://4.bp.blogspot.com/-ybqrjV3Y1Z8/WBOcMprlodI/AAAAAAAANX8/Ebjtpu0DwhM2clkn1_AOcS2-msLLqvnUgCLcB/s1600/Angular.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em; text-align: center;"><img border="0" height="640" src="https://4.bp.blogspot.com/-ybqrjV3Y1Z8/WBOcMprlodI/AAAAAAAANX8/Ebjtpu0DwhM2clkn1_AOcS2-msLLqvnUgCLcB/s640/Angular.png" width="568" /></a><br />
<br />
<b><u>Reference</u></b>: <a href="http://www.w3schools.com/angular/">http://www.w3schools.com/angular/</a></div>
Ritesh_Kesharwanihttp://www.blogger.com/profile/06191918659869264896noreply@blogger.com1tag:blogger.com,1999:blog-7638493.post-3577294829060234662016-07-08T12:06:00.003-07:002017-02-01T13:52:10.887-08:00Understand Action, Func and Delegate, workflow, calls with Lambda & Anonymous method etc.<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<b style="line-height: 14.65pt;"><span style="color: #242729; font-family: "arial" , sans-serif; font-size: 11.5pt;">Action</span></b><span style="color: #242729; font-family: "arial" , sans-serif; font-size: 11.5pt; line-height: 14.65pt;"> is a delegate (pointer) to a method, that takes zero, one or
more input parameters, but does <b>NOT</b>
return anything.</span></div>
<div class="MsoNormal" style="background: white; line-height: 14.65pt; margin-bottom: .0001pt; margin-bottom: 0in;">
<b><span style="color: #242729; font-family: "arial" , sans-serif; font-size: 11.5pt;"><br /></span></b></div>
<div class="MsoNormal" style="background: white; line-height: 14.65pt; margin-bottom: .0001pt; margin-bottom: 0in;">
<b><span style="color: #242729; font-family: "arial" , sans-serif; font-size: 11.5pt;">Func</span></b><span style="color: #242729; font-family: "arial" , sans-serif; font-size: 11.5pt;"> is a delegate (pointer) to a method, that takes zero, one or
more input parameters, and <b>DOES</b> returns a value (or reference).<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: 14.65pt; margin-bottom: .0001pt; margin-bottom: 0in;">
<b><span style="color: #242729; font-family: "arial" , sans-serif; font-size: 11.5pt;">Predicate</span></b><span style="color: #242729; font-family: "arial" , sans-serif; font-size: 11.5pt;"> is a special kind of Func often used for comparisons.<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: 14.65pt; margin-bottom: .0001pt; margin-bottom: 0in;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
</div>
<div class="MsoNormal" style="background: white; line-height: 14.65pt; margin-bottom: .0001pt; margin-bottom: 0in;">
<span style="color: #242729; font-family: "arial" , sans-serif; font-size: 11.5pt;">The difference between<span class="apple-converted-space"> </span></span><code><span style="background: #eff0f1; border: none 1.0pt; color: #242729; font-family: "consolas"; font-size: 10.0pt; padding: 0in;">Func</span></code><span class="apple-converted-space"><span style="color: #242729; font-family: "arial" , sans-serif; font-size: 11.5pt;"> </span></span><span style="color: #242729; font-family: "arial" , sans-serif; font-size: 11.5pt;">and<span class="apple-converted-space"> </span></span><code><span style="background: #eff0f1; border: none 1.0pt; color: #242729; font-family: "consolas"; font-size: 10.0pt; padding: 0in;">Action</span></code><span class="apple-converted-space"><span style="color: #242729; font-family: "arial" , sans-serif; font-size: 11.5pt;"> </span></span><span style="color: #242729; font-family: "arial" , sans-serif; font-size: 11.5pt;">is simply
whether you want the delegate to return a value (use<span class="apple-converted-space"> </span></span><code><span style="background: #eff0f1; border: none 1.0pt; color: #242729; font-family: "consolas"; font-size: 10.0pt; padding: 0in;">Func</span></code><span style="color: #242729; font-family: "arial" , sans-serif; font-size: 11.5pt;">) or not (use<span class="apple-converted-space"> </span></span><code><span style="background: #eff0f1; border: none 1.0pt; color: #242729; font-family: "consolas"; font-size: 10.0pt; padding: 0in;">Action</span></code><span style="color: #242729; font-family: "arial" , sans-serif; font-size: 11.5pt;">).<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "verdana" , sans-serif;"><span style="font-size: 9.5pt;">Action does not return value. </span><span style="font-size: 9.5pt;">Func and Action take up to 16 parameters, Func take one extra parameter for Return, so total parameter for Func is 17.</span></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><b><u>C#.NET Example to use <span style="color: red;">Func & Action</span></u></b> </span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: "consolas"; font-size: 9.5pt;">public</span><span style="font-family: "consolas"; font-size: 9.5pt;"> <span style="color: blue;">static</span> <b><span style="color: magenta;">double </span></b>CalculateSomething(<span style="color: blue;">int</span>
i, <span style="color: blue;">int</span> j)<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;">{<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;"> <span style="color: blue;">return</span> <span style="color: blue;">new</span> <span style="color: blue;">double</span>();<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;">}<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: "consolas"; font-size: 9.5pt;">public</span><span style="font-family: "consolas"; font-size: 9.5pt;"> <span style="color: blue;">static</span> <span style="color: blue;">void</span> DoSomething(<span style="color: blue;">int</span>
i, <span style="color: blue;">int</span> j)</span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;">{</span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;"> </span><span style="color: #2b91af; font-family: "consolas"; font-size: 9.5pt;">Console</span><span style="font-family: "consolas"; font-size: 9.5pt;">.WriteLine(<span style="color: #a31515;">"we are here..."</span>);</span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;">}</span></div>
<b><u><br /></u></b>
<b style="font-family: Consolas; font-size: 12.6667px;">//Call</b><br />
<span style="color: #2b91af; font-family: "consolas"; font-size: 9.5pt;"><b>Func</b></span><span style="font-family: "consolas"; font-size: 9.5pt;"><<span style="color: blue;">int</span>, <span style="color: blue;">int</span>, <b><span style="color: magenta;">double</span></b>> myFunc = (CalculateSomething);</span><br />
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: #2b91af; font-family: "consolas"; font-size: 9.5pt;"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: #2b91af; font-family: "consolas"; font-size: 9.5pt;"><b>Action</b></span><span style="font-family: "consolas"; font-size: 9.5pt;"><b><</b><span style="color: blue;">int</span>, <span style="color: blue;">int</span>> myAction = (DoSomething);</span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><br /></span></div>
<b><span style="color: magenta;">double </span></b>is return.output parameter<br />
<br />
<b><u>How <span style="color: red;">Delegate </span>works, just to compare with Action & Func</u></b><br />
<div class="MsoNormal">
<b><u><br /></u></b></div>
<div style="background: white;">
Delegate is a type which holds the method(s)
reference in an object. It is also referred to as a type safe function pointer.<o:p></o:p></div>
<div style="background: white;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: green; font-family: "consolas"; font-size: 10.0pt;">//Delegate declare</span><span style="font-family: "times new roman" , serif; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: "consolas"; font-size: 10.0pt;">public</span><span style="font-family: "consolas"; font-size: 10pt;"> </span><span style="color: blue; font-family: "consolas"; font-size: 10.0pt;">delegate</span><span style="font-family: "consolas"; font-size: 10pt;"> </span><span style="color: blue; font-family: "consolas"; font-size: 10.0pt;">int</span><span style="font-family: "consolas"; font-size: 10pt;"> </span><span style="color: #2b91af; font-family: "consolas"; font-size: 10.0pt;">MyOwnDelegate</span><span style="font-family: "consolas"; font-size: 10pt;">(</span><span style="color: blue; font-family: "consolas"; font-size: 10.0pt;">int</span><span style="font-family: "consolas"; font-size: 10pt;"> i, </span><span style="color: blue; font-family: "consolas"; font-size: 10.0pt;">int</span><span style="font-family: "consolas"; font-size: 10pt;"> j);</span><span style="font-family: "times new roman" , serif; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: "consolas"; font-size: 10.0pt;">private</span><span style="font-family: "consolas"; font-size: 10pt;"> </span><span style="color: blue; font-family: "consolas"; font-size: 10.0pt;">int</span><span style="font-family: "consolas"; font-size: 10pt;"> ShowAddition(</span><span style="color: blue; font-family: "consolas"; font-size: 10.0pt;">int</span><span style="font-family: "consolas"; font-size: 10pt;"> i, </span><span style="color: blue; font-family: "consolas"; font-size: 10.0pt;">int</span><span style="font-family: "consolas"; font-size: 10pt;"> j) { </span><span style="color: blue; font-family: "consolas"; font-size: 10.0pt;">return</span><span style="font-family: "consolas"; font-size: 10pt;"> i + j; }</span><span style="font-family: "times new roman" , serif; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: "consolas"; font-size: 10.0pt;">private</span><span style="font-family: "consolas"; font-size: 10pt;"> </span><span style="color: blue; font-family: "consolas"; font-size: 10.0pt;">int</span><span style="font-family: "consolas"; font-size: 10pt;"> ShowMultipy(</span><span style="color: blue; font-family: "consolas"; font-size: 10.0pt;">int</span><span style="font-family: "consolas"; font-size: 10pt;"> i, </span><span style="color: blue; font-family: "consolas"; font-size: 10.0pt;">int</span><span style="font-family: "consolas"; font-size: 10pt;"> j) { </span><span style="color: blue; font-family: "consolas"; font-size: 10.0pt;">return</span><span style="font-family: "consolas"; font-size: 10pt;"> i * j; }</span><span style="font-family: "times new roman" , serif; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<b><span style="font-family: "consolas"; font-size: 10pt;">//Call</span></b><span style="font-family: "times new roman" , serif; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: #2b91af; font-family: "consolas"; font-size: 10.0pt;">MyOwnDelegate</span><span style="font-family: "consolas"; font-size: 10pt;"> dele = </span><span style="color: blue; font-family: "consolas"; font-size: 10.0pt;">new</span><span style="font-family: "consolas"; font-size: 10pt;"> </span><span style="color: #2b91af; font-family: "consolas"; font-size: 10.0pt;">MyOwnDelegate</span><span style="font-family: "consolas"; font-size: 10pt;">(ShowAddition);</span><span style="font-family: "times new roman" , serif; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 10pt;">dele(10, 20); </span><span style="color: green; font-family: "consolas"; font-size: 10.0pt;">//Output 30</span><span style="font-family: "times new roman" , serif; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: green; font-family: "consolas"; font-size: 10.0pt;">//If it hold reference of more then one method
then it called <b>MultiCast Delegate</b></span><span style="font-family: "times new roman" , serif; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 10pt;">dele += </span><span style="color: blue; font-family: "consolas"; font-size: 10.0pt;">new</span><span style="font-family: "consolas"; font-size: 10pt;"> </span><span style="color: #2b91af; font-family: "consolas"; font-size: 10.0pt;">MyOwnDelegate</span><span style="font-family: "consolas"; font-size: 10pt;">(ShowMultipy);</span><span style="font-family: "times new roman" , serif; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 10pt;">dele(10, 20); </span><span style="color: green; font-family: "consolas"; font-size: 10.0pt;">//Output 30 and 200</span><span style="font-family: "times new roman" , serif; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 10pt;"> </span><span style="font-family: "times new roman" , serif; font-size: 10pt;"><o:p></o:p></span></div>
<div style="background: white;">
</div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: #111111; font-family: "segoe ui" , sans-serif; font-size: 10.0pt;">Then the</span><span style="font-family: "segoe ui" , sans-serif; font-size: 10pt;"> </span><span style="color: #111111; font-family: "segoe ui" , sans-serif; font-size: 10.0pt;">Delegate is added using the</span><span style="font-family: "segoe ui" , sans-serif; font-size: 10pt;"> </span><span style="color: #111111; font-family: "segoe ui" , sans-serif; font-size: 10.0pt;">+=</span><span style="font-family: "segoe ui" , sans-serif; font-size: 10pt;"> </span><span style="color: #111111; font-family: "segoe ui" , sans-serif; font-size: 10.0pt;">operator and removed using the -=</span><span style="font-family: "segoe ui" , sans-serif; font-size: 10pt;"> </span><span style="color: #111111; font-family: "segoe ui" , sans-serif; font-size: 10.0pt;">operator. </span><span style="font-family: "times new roman" , serif; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: #111111; font-family: "segoe ui" , sans-serif; font-size: 10.5pt;"> </span><span style="font-family: "consolas"; font-size: 9.5pt;"> </span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><br /></span></div>
<b><u>How <span style="color: red;">Func </span>works</u></b><br />
<br />
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: "consolas"; font-size: 9.5pt;">public</span><span style="font-family: "consolas"; font-size: 9.5pt;"> <span style="color: blue;">sealed</span> <span style="color: blue;">class</span> <span style="color: #2b91af;">emp</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;">{<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;"> <span style="color: blue;">public</span> <span style="color: blue;">double</span> Calculate(<b><span style="color: #2b91af;">Func</span><</b><span style="color: blue;">double</span>, <span style="color: blue;">double</span>> op)<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;"> <span style="color: blue;">return</span> op(20);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;">}<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: "consolas"; font-size: 9.5pt;">public</span><span style="font-family: "consolas"; font-size: 9.5pt;"> <span style="color: blue;">class</span> <span style="color: #2b91af;">Program</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;">{ </span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: "consolas"; font-size: 9.5pt; text-indent: 0.5in;"> public</span><span style="font-family: "consolas"; font-size: 9.5pt; text-indent: 0.5in;"> <span style="color: blue;">static</span> <span style="color: blue;">double</span> Display(<span style="color: blue;">double</span> i)</span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt; text-indent: 0.5in;"> {</span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;"> <span style="color: blue;">return</span> i*9;</span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt; text-indent: 0.5in;"> }</span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;"> </span><span style="color: blue; font-family: "consolas"; font-size: 9.5pt; text-indent: 0.5in;">private</span><span style="font-family: "consolas"; font-size: 9.5pt; text-indent: 0.5in;"> <span style="color: blue;">static</span> <span style="color: blue;">void</span> Main(<span style="color: blue;">string</span>[] args)</span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt; text-indent: 0.5in;"> {</span></div>
<b> </b><b style="font-family: Consolas; font-size: 12.6667px;">//Call</b><br />
<div style="text-indent: 0px;">
<span style="font-family: "consolas"; font-size: 12.6667px; text-indent: 0.5in;"><b> </b></span><span style="color: #2b91af; font-family: "consolas"; font-size: 9.5pt; text-indent: 0.5in;">emp</span><span style="font-family: "consolas"; font-size: 9.5pt; text-indent: 0.5in;"> e = </span><span style="color: blue; font-family: "consolas"; font-size: 9.5pt; text-indent: 0.5in;">new</span><span style="font-family: "consolas"; font-size: 9.5pt; text-indent: 0.5in;"> </span><span style="color: #2b91af; font-family: "consolas"; font-size: 9.5pt; text-indent: 0.5in;">emp</span><span style="font-family: "consolas"; font-size: 9.5pt; text-indent: 0.5in;">();</span></div>
<div style="text-indent: 0px;">
<span style="font-family: "consolas"; font-size: 9.5pt; text-indent: 0.5in;"> </span><span style="color: blue; font-family: "consolas"; font-size: 9.5pt; text-indent: 0.5in;">double</span><span style="font-family: "consolas"; font-size: 9.5pt; text-indent: 0.5in;"> d1 = e.Calculate(Display);</span><br />
<span style="font-family: "consolas"; font-size: 9.5pt; text-indent: 0.5in;"><br /></span>
<span style="font-family: "consolas"; font-size: 9.5pt; text-indent: 0.5in;"> <span style="color: #6aa84f;">//Another way to call this function, with inline function</span></span><br />
<span style="font-family: "consolas"; font-size: 9.5pt; text-indent: 0.5in;"> </span><span style="color: blue; font-family: "consolas"; font-size: 9.5pt; text-indent: 0.5in;">double</span><span style="font-family: "consolas"; font-size: 9.5pt; text-indent: 0.5in;"> d1 = e.Calculate(r => 2*Math.PT*r);</span></div>
<div style="text-indent: 0px;">
<span style="font-family: "consolas"; font-size: 9.5pt; text-indent: 0.5in;"> }</span></div>
<div style="text-indent: 0px;">
<span style="text-indent: 0.5in;">}</span></div>
<div class="MsoNormal">
<o:p></o:p></div>
<div class="MsoNormal">
</div>
<ol>
<li>‘Calculate’ function takes input parameter as function name ‘Display’ to execute</li>
<li>First control goes inside ‘Calculate’ function and convert op(20) into Display(20).</li>
<li>Then control go to ‘Display’ function, which is taking ‘20’ as an input parameter and convert i*9 into 20*9 and</li>
<li>Final Output of d1 is 180;</li>
</ol>
<br />
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<b><u><span style="color: red;">Action </span>uses for Lambda & Anonymous method</u></b></div>
<br />
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: "consolas"; font-size: 9.5pt;">public</span><span style="font-family: "consolas"; font-size: 9.5pt;"> <span style="color: blue;">class</span> <span style="color: #2b91af;">Base</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;">{<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;"> <span style="color: blue;">public</span> <span style="color: blue;">void</span> Foo(<b><span style="color: #2b91af;">Action</span> </b>action)<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;"> <span style="color: #2b91af;">Console</span>.WriteLine(<span style="color: #a31515;">"Action
with No Param..."</span>);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;"> <span style="color: blue;">public</span> <span style="color: blue;">void</span> Foo(<b><span style="color: #2b91af;">Action</span><</b><span style="color: blue;">int</span>>
action)<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;"> <span style="color: #2b91af;">Console</span>.WriteLine(<span style="color: #a31515;">"Action
with ONE param..."</span>);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;"> </span><span style="font-family: "consolas"; font-size: 9.5pt;"> </span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: "consolas"; font-size: 9.5pt;"> public</span><span style="font-family: "consolas"; font-size: 9.5pt;"> </span><span style="color: blue; font-family: "consolas"; font-size: 9.5pt;">void</span><span style="font-family: "consolas"; font-size: 9.5pt;"> Foo(</span><b><span style="color: #2b91af; font-family: "consolas"; font-size: 9.5pt;">Action</span><span style="font-family: "consolas"; font-size: 9.5pt;"><</span></b><span style="color: blue; font-family: "consolas"; font-size: 9.5pt;">int</span><span style="font-family: "consolas"; font-size: 9.5pt;">, </span><span style="color: blue; font-family: "consolas"; font-size: 9.5pt;">int</span><span style="font-family: "consolas"; font-size: 9.5pt;">> action)</span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;"> <span style="color: #2b91af;">Console</span>.WriteLine(<span style="color: #a31515;">"Action
with TWO param..."</span>);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;"> }</span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;">}</span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><b>//Call</b></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: #2b91af; font-family: "consolas"; font-size: 9.5pt;">Base</span><span style="font-family: "consolas"; font-size: 9.5pt;"> d = <span style="color: blue;">new</span> <span style="color: #2b91af;">Base</span>();<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: "consolas"; font-size: 9.5pt;">int</span><span style="font-family: "consolas"; font-size: 9.5pt;"> x = 0;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<b><span style="color: green; font-family: "consolas"; font-size: 9.5pt;">//lambda expression</span><span style="font-family: "consolas"; font-size: 9.5pt;"><o:p></o:p></span></b></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;">d.Foo(() => { x = 0; }); <span style="color: green;">// Call Foo
with No param in Action</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;">d.Foo((i) => { x = 0; }); <span style="color: green;">// Call Foo
with ONE param in Action</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;">d.Foo((i, j) => { x = 0; }); <span style="color: green;">// Call Foo with
TWO param in Action</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<b><span style="color: green; font-family: "consolas"; font-size: 9.5pt;">//Anonymous Method</span><span style="font-family: "consolas"; font-size: 9.5pt;"><o:p></o:p></span></b></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;">d.Foo(<span style="color: blue;">delegate</span>() {
x = 0; }); <span style="color: green;">// Call Foo with No param in Action</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;">d.Foo(<span style="color: blue;">delegate</span>(<span style="color: blue;">int</span> i) { x = 1; }); <span style="color: green;">// Call Foo
with ONE param in Action</span></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;">d.Foo(</span><span style="color: blue; font-family: "consolas"; font-size: 9.5pt;">delegate</span><span style="font-family: "consolas"; font-size: 9.5pt;">(</span><span style="color: blue; font-family: "consolas"; font-size: 9.5pt;">int</span><span style="font-family: "consolas"; font-size: 9.5pt;"> i, </span><span style="color: blue; font-family: "consolas"; font-size: 9.5pt;">int</span><span style="font-family: "consolas"; font-size: 9.5pt;"> j) { x =
2; }); </span><span style="color: green; font-family: "consolas"; font-size: 9.5pt;">//
Call Foo with TWO param in Action</span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><span style="color: green;"><br /></span></span></div>
<b><u><span style="color: red;">Func </span>uses for Lambda & Anonymous method</u></b><br />
<div>
<span style="color: blue; font-family: "consolas"; font-size: 9.5pt;"><br /></span></div>
<div>
<span style="color: blue; font-family: "consolas"; font-size: 9.5pt;">public</span><span style="font-family: "consolas"; font-size: 9.5pt;"> <span style="color: blue;">class</span> <span style="color: #2b91af;">Base</span></span></div>
<div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;">{</span><span style="font-family: "consolas"; font-size: 9.5pt;"> </span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;"> <span style="color: blue;">public</span> <span style="color: blue;">int</span> Foo(<span style="color: #2b91af;"><b>Func</b></span><<span style="color: blue;">int</span>>
action)<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;"> <span style="color: #2b91af;">Console</span>.WriteLine(<span style="color: #a31515;">"Func
with No Param..."</span>);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;"> <span style="color: blue;">return</span> 1;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;"> <span style="color: blue;">public</span> <span style="color: blue;">int</span> Foo(<b><span style="color: #2b91af;">Func</span><</b><span style="color: blue;">int</span>,<span style="color: blue;">int</span>> action)<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;"> <span style="color: #2b91af;">Console</span>.WriteLine(<span style="color: #a31515;">"Func
with No Param..."</span>);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;"> <span style="color: blue;">return</span> 2;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;"> <span style="color: blue;">public</span> <span style="color: blue;">int</span> Foo(<b><span style="color: #2b91af;">Func</span><</b><span style="color: blue;">int</span>, <span style="color: blue;">int</span>,<span style="color: blue;">int</span>> action)<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;"> <span style="color: #2b91af;">Console</span>.WriteLine(<span style="color: #a31515;">"Func
with TWO param..."</span>);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;"> <span style="color: blue;">return</span> 3;</span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;"> }</span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;">}</span></div>
</div>
<br />
<b style="font-family: Consolas; font-size: 12.6667px;">//Call</b><br />
<span style="color: #2b91af; font-family: "consolas"; font-size: 9.5pt;">Base</span><span style="font-family: "consolas"; font-size: 9.5pt;"> d = <span style="color: blue;">new</span> <span style="color: #2b91af;">Base</span>();</span><br />
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><span style="color: blue;">int</span> x = 0;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><b><span style="color: green;">//lambda expression</span><o:p></o:p></b></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;">d.Foo(()
=> 0); <span style="color: green;">// Call Foo with No param in
Func</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;">d.Foo((<span style="color: blue;">int</span> i) => 10);
<span style="color: green;">//
Call Foo wit ONE param in Func</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;">d.Foo((<span style="color: blue;">int</span> i, <span style="color: blue;">int</span> j) =>
20); <span style="color: green;">// Call Foo with TWO param in Func</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><b><span style="color: green;">//Anonymous Method</span><o:p></o:p></b></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;">d.Foo(<span style="color: blue;">delegate</span>() { <span style="color: blue;">return</span>
1; }); <span style="color: green;">// Call Foo with No
param in Func</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;">d.Foo(<span style="color: blue;">delegate</span>(<span style="color: blue;">int</span> i) { <span style="color: blue;">return</span> 1; }); <span style="color: green;">// Call Foo with
ONE param in Func</span></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 9.5pt;">d.Foo(</span><span style="color: blue; font-family: "consolas"; font-size: 9.5pt;">delegate</span><span style="font-family: "consolas"; font-size: 9.5pt;">(</span><span style="color: blue; font-family: "consolas"; font-size: 9.5pt;">int</span><span style="font-family: "consolas"; font-size: 9.5pt;"> i, </span><span style="color: blue; font-family: "consolas"; font-size: 9.5pt;">int</span><span style="font-family: "consolas"; font-size: 9.5pt;"> j) { </span><span style="color: blue; font-family: "consolas"; font-size: 9.5pt;">return</span><span style="font-family: "consolas"; font-size: 9.5pt;"> 1;
}); </span><span style="color: green; font-family: "consolas"; font-size: 9.5pt;">// Call Foo with TWO param in Func</span></div>
</div>
Ritesh_Kesharwanihttp://www.blogger.com/profile/06191918659869264896noreply@blogger.com0tag:blogger.com,1999:blog-7638493.post-86675399322629044392016-05-20T08:59:00.003-07:002016-05-20T09:00:11.725-07:00Support high volume data transfer by WCF service<div dir="ltr" style="text-align: left;" trbidi="on">
Sometime the requirement is send big data to WCF service from client, basically looking for option to send high data through the wire.<br />
<br />
WCF can support up to 2 GB data through the wire; even though it is not recommended.<br />
<br />
To enable this we need to set some attributes to binding tags in Server and Client side config file<br />
<br />
<b><u>Server Config File</u></b><br />
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;"><</span><span style="background: white; color: #a31515; font-family: "consolas"; font-size: 9.5pt;">bindings</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;">></span><span style="background: white; font-family: "consolas"; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;"> <</span><span style="background: white; color: #a31515; font-family: "consolas"; font-size: 9.5pt;">wsHttpBinding</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;">></span><span style="background: white; font-family: "consolas"; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;"> <</span><span style="background: white; color: #a31515; font-family: "consolas"; font-size: 9.5pt;">binding</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;"> </span><span style="background: white; color: red; font-family: "consolas"; font-size: 9.5pt;">name</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;">=</span><span style="background: white; font-family: "consolas"; font-size: 9.5pt;">"</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;"><b>wsHttpBindingSettings</b></span><span style="background: white; font-family: "consolas"; font-size: 9.5pt;">"</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;"> </span><span style="background: white; color: red; font-family: "consolas"; font-size: 9.5pt;">maxReceivedMessageSize</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;">=</span><span style="background: white; font-family: "consolas"; font-size: 9.5pt;">"</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;">2147483647</span><span style="background: white; font-family: "consolas"; font-size: 9.5pt;">"</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;">></span><span style="background: white; font-family: "consolas"; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;"> <</span><span style="background: white; color: #a31515; font-family: "consolas"; font-size: 9.5pt;">readerQuotas</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;"> </span><span style="background: white; font-family: "consolas"; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;"> </span><span style="background: white; color: red; font-family: "consolas"; font-size: 9.5pt;">maxDepth</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;">=</span><span style="background: white; font-family: "consolas"; font-size: 9.5pt;">"</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;">2147483647</span><span style="background: white; font-family: "consolas"; font-size: 9.5pt;">"</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;"> </span><span style="background: white; font-family: "consolas"; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;"> </span><span style="background: white; color: red; font-family: "consolas"; font-size: 9.5pt;">maxStringContentLength</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;">=</span><span style="background: white; font-family: "consolas"; font-size: 9.5pt;">"</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;">2147483647</span><span style="background: white; font-family: "consolas"; font-size: 9.5pt;">"</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;"> </span><span style="background: white; font-family: "consolas"; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;"> </span><span style="background: white; color: red; font-family: "consolas"; font-size: 9.5pt;">maxArrayLength</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;">=</span><span style="background: white; font-family: "consolas"; font-size: 9.5pt;">"</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;">2147483647</span><span style="background: white; font-family: "consolas"; font-size: 9.5pt;">"</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;"> </span><span style="background: white; font-family: "consolas"; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;"> </span><span style="background: white; color: red; font-family: "consolas"; font-size: 9.5pt;">maxBytesPerRead</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;">=</span><span style="background: white; font-family: "consolas"; font-size: 9.5pt;">"</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;">2147483647</span><span style="background: white; font-family: "consolas"; font-size: 9.5pt;">"</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;"> </span><span style="background: white; font-family: "consolas"; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;"> </span><span style="background: white; color: red; font-family: "consolas"; font-size: 9.5pt;">maxNameTableCharCount</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;">=</span><span style="background: white; font-family: "consolas"; font-size: 9.5pt;">"</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;">2147483647</span><span style="background: white; font-family: "consolas"; font-size: 9.5pt;">"</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;">/></span><span style="background: white; font-family: "consolas"; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;"> </</span><span style="background: white; color: #a31515; font-family: "consolas"; font-size: 9.5pt;">binding</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;">></span><span style="background: white; font-family: "consolas"; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;"> </</span><span style="background: white; color: #a31515; font-family: "consolas"; font-size: 9.5pt;">wsHttpBinding</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;">></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt; line-height: 107%;"></</span><span style="background: white; color: #a31515; font-family: "consolas"; font-size: 9.5pt; line-height: 107%;">bindings</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt; line-height: 107%;">></span></div>
<div class="MsoNormal">
<o:p></o:p></div>
<div class="MsoNormal">
<span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt; line-height: 107%;"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;"><</span><span style="background: white; color: #a31515; font-family: "consolas"; font-size: 9.5pt;">endpoint</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;"> <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt; text-indent: 0.5in;">
<span style="background: white; color: red; font-family: "consolas"; font-size: 9.5pt;">address</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;">=</span><span style="background: white; font-family: "consolas"; font-size: 9.5pt;">""</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;"> <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt; text-indent: 0.5in;">
<span style="background: white; color: red; font-family: "consolas"; font-size: 9.5pt;">binding</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;">=</span><span style="background: white; font-family: "consolas"; font-size: 9.5pt;">"</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;">wsHttpBinding</span><span style="background: white; font-family: "consolas"; font-size: 9.5pt;">"</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;"> <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt; text-indent: 0.5in;">
<span style="background: white; color: red; font-family: "consolas"; font-size: 9.5pt;">contract</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;">=</span><span style="background: white; font-family: "consolas"; font-size: 9.5pt;">"</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;">WcfService1.IService1</span><span style="background: white; font-family: "consolas"; font-size: 9.5pt;">"</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;"> <o:p></o:p></span></div>
<div class="MsoNormal">
</div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt; text-indent: 0.5in;">
<b><span style="background: white; color: red; font-family: "consolas"; font-size: 9.5pt;">bindingConfiguration</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;">=</span><span style="background: white; font-family: "consolas"; font-size: 9.5pt;">"</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;">wsHttpBindingSettings</span><span style="background: white; font-family: "consolas"; font-size: 9.5pt;">"</span></b><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;">></span><span style="background-color: white; color: blue; font-family: "consolas"; font-size: 9.5pt; line-height: 107%;"> </span></div>
<div class="MsoNormal">
<span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt; line-height: 107%;"><br /></span></div>
<div class="MsoNormal">
<span style="background: white; font-family: "consolas"; font-size: 9.5pt; line-height: 107%;"><b style="background-color: transparent;"><u>Client Config File</u></b> </span><o:p></o:p></div>
<div class="MsoNormal">
<span style="background: white; font-family: "consolas"; font-size: 9.5pt; line-height: 107%;"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;"><</span><span style="background: white; color: #a31515; font-family: "consolas"; font-size: 9.5pt;">bindings</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;">></span><span style="background: white; font-family: "consolas"; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;"> <</span><span style="background: white; color: #a31515; font-family: "consolas"; font-size: 9.5pt;">wsHttpBinding</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;">></span><span style="background: white; font-family: "consolas"; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;"> <</span><span style="background: white; color: #a31515; font-family: "consolas"; font-size: 9.5pt;">binding</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;"> <o:p></o:p></span></div>
<div class="MsoNormal" style="margin: 0in 0in 0.0001pt 0.5in; text-indent: 0.5in;">
<b><span style="background: white; color: red; font-family: "consolas"; font-size: 9.5pt;">name</span></b><b><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;">=</span></b><b><span style="background: white; font-family: "consolas"; font-size: 9.5pt;">"</span></b><b><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;">WSHttpBinding_IService1</span></b><b><span style="background: white; font-family: "consolas"; font-size: 9.5pt;">"</span></b><b><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;"> <o:p></o:p></span></b></div>
<div class="MsoNormal" style="margin: 0in 0in 0.0001pt 0.5in; text-indent: 0.5in;">
<span style="background: white; color: red; font-family: "consolas"; font-size: 9.5pt;">maxBufferPoolSize</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;">=</span><span style="background: white; font-family: "consolas"; font-size: 9.5pt;">"</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;">2147483647</span><span style="background: white; font-family: "consolas"; font-size: 9.5pt;">"<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;"> </span><span style="background: white; color: red; font-family: "consolas"; font-size: 9.5pt;">maxReceivedMessageSize</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;">=</span><span style="background: white; font-family: "consolas"; font-size: 9.5pt;">"</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;">2147483647</span><span style="background: white; font-family: "consolas"; font-size: 9.5pt;">"</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;">></span><span style="background: white; font-family: "consolas"; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;"> <</span><span style="background: white; color: #a31515; font-family: "consolas"; font-size: 9.5pt;">readerQuotas</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;"> <o:p></o:p></span></div>
<div class="MsoNormal" style="margin: 0in 0in 0.0001pt 0.5in; text-indent: 0.5in;">
<span style="background: white; color: red; font-family: "consolas"; font-size: 9.5pt;">maxStringContentLength</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;">=</span><span style="background: white; font-family: "consolas"; font-size: 9.5pt;">"</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;">2147483647</span><span style="background: white; font-family: "consolas"; font-size: 9.5pt;">"</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;"> <o:p></o:p></span></div>
<div class="MsoNormal" style="margin: 0in 0in 0.0001pt 0.5in; text-indent: 0.5in;">
<span style="background: white; color: red; font-family: "consolas"; font-size: 9.5pt;">maxArrayLength</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;">=</span><span style="background: white; font-family: "consolas"; font-size: 9.5pt;">"</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;">2147483647</span><span style="background: white; font-family: "consolas"; font-size: 9.5pt;">"<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;"> </span><span style="background: white; color: red; font-family: "consolas"; font-size: 9.5pt;">maxBytesPerRead</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;">=</span><span style="background: white; font-family: "consolas"; font-size: 9.5pt;">"</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;">2147483647</span><span style="background: white; font-family: "consolas"; font-size: 9.5pt;">"</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;"> <o:p></o:p></span></div>
<div class="MsoNormal" style="margin: 0in 0in 0.0001pt 1in;">
<span style="background: white; color: red; font-family: "consolas"; font-size: 9.5pt;">maxNameTableCharCount</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;">=</span><span style="background: white; font-family: "consolas"; font-size: 9.5pt;">"</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;">2147483647</span><span style="background: white; font-family: "consolas"; font-size: 9.5pt;">"</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;"> /></span><span style="background: white; font-family: "consolas"; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;"> </</span><span style="background: white; color: #a31515; font-family: "consolas"; font-size: 9.5pt;">binding</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;">></span><span style="background: white; font-family: "consolas"; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;"> </</span><span style="background: white; color: #a31515; font-family: "consolas"; font-size: 9.5pt;">wsHttpBinding</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;">></span><span style="background: white; font-family: "consolas"; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;"></</span><span style="background: white; color: #a31515; font-family: "consolas"; font-size: 9.5pt;">bindings</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;">></span><span style="background: white; font-family: "consolas"; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;"> <</span><span style="background: white; color: #a31515; font-family: "consolas"; font-size: 9.5pt;">endpoint</span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt; text-indent: 0.5in;">
<span style="background: white; color: red; font-family: "consolas"; font-size: 9.5pt;">address</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;">=</span><span style="background: white; font-family: "consolas"; font-size: 9.5pt;">"</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;">http://localhost:59284/Service1.svc</span><span style="background: white; font-family: "consolas"; font-size: 9.5pt;">"</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;"> <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt; text-indent: 0.5in;">
<span style="background: white; color: red; font-family: "consolas"; font-size: 9.5pt;">binding</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;">=</span><span style="background: white; font-family: "consolas"; font-size: 9.5pt;">"</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;">wsHttpBinding</span><span style="background: white; font-family: "consolas"; font-size: 9.5pt;">"<o:p></o:p></span></div>
<div class="MsoNormal" style="margin: 0in 0in 0.0001pt 0.5in; text-indent: 0.75pt;">
<b><span style="background: white; color: red; font-family: "consolas"; font-size: 9.5pt;">bindingConfiguration</span></b><b><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;">=</span></b><b><span style="background: white; font-family: "consolas"; font-size: 9.5pt;">"</span></b><b><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;">WSHttpBinding_IService1</span></b><b><span style="background: white; font-family: "consolas"; font-size: 9.5pt;">"</span></b><b><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;"> </span></b></div>
<div class="MsoNormal" style="margin: 0in 0in 0.0001pt 0.5in; text-indent: 0.75pt;">
<span style="background: white; color: red; font-family: "consolas"; font-size: 9.5pt;">contract</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;">=</span><span style="background: white; font-family: "consolas"; font-size: 9.5pt;">"</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;">ServiceReference1.IService1</span><span style="background: white; font-family: "consolas"; font-size: 9.5pt;">"<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background: white; font-family: "consolas"; font-size: 9.5pt; line-height: 107%;">
</span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;"> </span><span style="background: white; color: red; font-family: "consolas"; font-size: 9.5pt;">name</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;">=</span><span style="background: white; font-family: "consolas"; font-size: 9.5pt;">"</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;">WSHttpBinding_IService1</span><span style="background: white; font-family: "consolas"; font-size: 9.5pt;">"</span><span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;">></span><span style="background: white; font-family: "consolas"; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: "consolas"; font-size: 9.5pt;"><br /></span></div>
</div>
Ritesh_Kesharwanihttp://www.blogger.com/profile/06191918659869264896noreply@blogger.com0tag:blogger.com,1999:blog-7638493.post-12309861162955042182016-05-19T13:18:00.003-07:002016-05-19T13:18:58.496-07:00The client certificate is not provided. specify a client certificate in clientcredentials.<div dir="ltr" style="text-align: left;" trbidi="on">
I have done all the setup; require to setup WCF message security and tried calling service from client, is working fine without any issues.<br />
later I made few changes on the service and again use 'Update Service Reference' to update my service. suddenly service stop working and gave below error<br />
<span style="color: red;"> "The client certificate is not provided. specify a client certificate in clientcredentials."</span><br />
<span style="color: red;"><br /></span>
<b><u>Cause</u></b><br />
As soon as I did service update; client side config file updated with new endpoint section, that removed (custom) one attribute 'behaviorConfiguration'.<br />
<br />
<b><u>Solution</u></b><br />
After updating the service reference add 'behaviorConfiguration' attribute to endpoint section like below<br />
<br />
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"><</span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">endpoint</span><span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"> </span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: red; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">address</span><span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">=</span><span style="background: white; font-family: Consolas; font-size: 9.5pt;">"</span><span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">http://localhost:65514/Service1.svc</span><span style="background: white; font-family: Consolas; font-size: 9.5pt;">"</span><span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"> </span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: red; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">binding</span><span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">=</span><span style="background: white; font-family: Consolas; font-size: 9.5pt;">"</span><span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">wsHttpBinding</span><span style="background: white; font-family: Consolas; font-size: 9.5pt;">"<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: red; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">bindingConfiguration</span><span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">=</span><span style="background: white; font-family: Consolas; font-size: 9.5pt;">"</span><span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">WSHttpBinding_IService1</span><span style="background: white; font-family: Consolas; font-size: 9.5pt;">"</span><span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"> </span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: red; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">contract</span><span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">=</span><span style="background: white; font-family: Consolas; font-size: 9.5pt;">"</span><span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">ServiceReference1.IService1</span><span style="background: white; font-family: Consolas; font-size: 9.5pt;">"<o:p></o:p></span></div>
<br />
<div class="MsoNormal">
<span style="background: white; color: red; font-family: Consolas; font-size: 9.5pt; line-height: 107%; mso-highlight: white;">name</span><span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; line-height: 107%; mso-highlight: white;">=</span><span style="background: white; font-family: Consolas; font-size: 9.5pt; line-height: 107%;">"</span><span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; line-height: 107%; mso-highlight: white;">WSHttpBinding_IService1</span><span style="background: white; font-family: Consolas; font-size: 9.5pt; line-height: 107%;">"</span></div>
<div class="MsoNormal">
<b><span style="background: white; color: red; font-family: Consolas; font-size: 9.5pt; line-height: 107%; mso-highlight: white;">behaviorConfiguration</span><span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; line-height: 107%; mso-highlight: white;">=</span><span style="background: white; font-family: Consolas; font-size: 9.5pt; line-height: 107%;">"</span><span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; line-height: 107%; mso-highlight: white;">CustomBehavior</span></b><span style="background: white; font-family: Consolas; font-size: 9.5pt; line-height: 107%;">"</span><span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; line-height: 107%;">></span></div>
<div class="MsoNormal">
<o:p></o:p></div>
<br />
If you have added any kinds of attributes; that will be removed after you update service using 'Update Service Reference'.</div>
Ritesh_Kesharwanihttp://www.blogger.com/profile/06191918659869264896noreply@blogger.com0