In my situation, the web application has the following configuration:
<httpCookies requireSSL="true" />
Also, the forms authentication is configured as reureSSL="true".
I noticed that when I change the host to local IIS, the HTTP instead of HTTPS is used in the url. After I change the protocol to https, then I can run the application in Visual Studio.