'ERR_SSL_PROTOCOL_ERROR when connecting to Azure Active Directory

I am trying to connect to Azure Active Directory based on this article: Azure

I am running an ASP.NET MVC application and when I run the application connecting to azure active directory, my username and password is accepted, but then after that, I get an error showing "ERR_SSL_PROTOCOL_ERROR" .

This is my sigin code:

public void SignIn()
{
    if (!Request.IsAuthenticated)
    {
        HttpContext.GetOwinContext().Authentication.Challenge(
                    new AuthenticationProperties { RedirectUri = "/" },
                    OpenIdConnectAuthenticationDefaults.AuthenticationType); 
            }
    }
}

This is my configuration in the web.config file:

<appSettings>
    <add key="ClientId" value="XXXXXXXXX" />
    <add key="Tenant" value="XXXXXXXXXXXXXXXX" />
    <add key="Authority" value="https://login.microsoftonline.com/{0}/v2.0" />
    <add key="redirectUri" value="https://localhost:44347/login/oauth2/code/" />
</appSettings>

My application is running on port # 44368

https://localhost:44368/

This is the screen shot:

enter image description here

My applicationhost.config file binding information is like this:

<bindings>
    <binding protocol="https" bindingInformation="*:44368:localhost" />
    <binding protocol="http" bindingInformation="*:53016:localhost" />
</bindings>

I haven't changed any default settings that are created by the application. I didn't change the applicationhost.config file or the port number of the application. My redirectURI in the azure portal is 44347. Do I need to change anything in the applicationhost.config file or application port # in order to get rid of ERR_SSL_PROTOCOL_ERROR. My network team gave me two URL's that are configured in azure portal. Should I just use http instead of https:

http://localhost:44347/login/oauth2/code/
https://localhost:44347/login/oauth2/code/

Any help will be greatly appreciated.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source