Search This Blog

Tuesday, December 19, 2017

What is sendgrid ??

SendGrid is a cloud-based SMTP provider that allows you to send email without having to 

maintain email servers. SendGrid manages all of the technical details, from scaling the 

infrastructure to ISP outreach and reputation monitoring to whitelist services and real time

analytics.

SendGrid mail code:

using SendGridMail;
using SendGridMail.Transport;


public bool SendEmailThroughSendGrid(string MailTo, string DisplayName, string Subject, string MailFrom, string MailBody)
    {
        try
        {
            string sgUsername = "***********";
            string sgPassword = "***************";
            SendGrid myMessage = SendGrid.GetInstance();
            myMessage.AddTo(MailTo);
            myMessage.From = new MailAddress(MailFrom, DisplayName);
            myMessage.Subject = Subject;
            myMessage.Text = "";
            myMessage.Html = MailBody;
            var credentials = new NetworkCredential(sgUsername, sgPassword);
            var transportWeb = Web.GetInstance(credentials);
            transportWeb.Deliver(myMessage);
            return true;
        }
        catch (Exception)
        {
            return false;
        }
        finally
        {

        }
    }




Error: The program '[3148] iisexpress.exe' has exited with code -1073741816 (0xc0000008) 'An invalid handle was specified'.

Process with an ID #### is not running on Visual Studio 2015

Error:

The program '[3148] iisexpress.exe' has exited with code -1073741816 (0xc0000008) 'An invalid handle was specified'.

1.       Delete the \Documents\IISExpress folder using the following console command: rmdir /s /q "%userprofile%\Documents\IISExpress"
2.       Delete the applicationhost.config file which is placed within the \.vs\Config\ folder in your Visual Studio project root folder.
3.       Close Visual Studio and re-start it with Administrative (right-click > Run as Administrator).
The .vs is a hidden folder so you have to enable the Show hidden files, folders, and drives option in Windows Explorer.

E:\CP\xxxxxx\.vs\config




we create an application at IIS and enable the windows authentication then it is stored ApplicationHost.config as


         <sites>
            <site name="WebSite1" id="1" serverAutoStart="true">
                <application path="/">
                    <virtualDirectory path="/" physicalPath="%IIS_SITES_HOME%\WebSite1" />
                </application>
                <bindings>
                    <binding protocol="http" bindingInformation=":8080:localhost" />
                </bindings>
            </site>
            <site name="xxxxxxx" id="2">
                <application path="/" applicationPool="Clr4IntegratedAppPool">
                    <virtualDirectory path="/" physicalPath="E:\CP\xxxxxxx\webadhar" />
                </application>
                <bindings>
                    <binding protocol="http" bindingInformation="*:65417:localhost" />
                </bindings>
            </site>