127.0.0.1该网站无法提供安全的连接 [英] 127.0.0.1 This site can’t provide a secure connection

查看:823
本文介绍了127.0.0.1该网站无法提供安全的连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个ASP.NET Web应用程序,当前正在使用Visual Studio的IIS Express内置程序运行它.它通常在localhost上启动,并且运行良好.但是,我正在调用的外部API之一要求将应用程序的回调重定向到127.0.0.1而不是localhost(它使用OAuth2流进行身份验证).我意识到localhost只是127.0.0.1的别名,但是由于某些原因,我无法使我的应用程序在127.0.0.1上运行.

我进入了"Web"标签下的项目设置,并将开始操作>开始URL 服务器>项目URL 都更改为http://127.0.0.1:25436,甚至进入IIS Express的applicationhost.config并从中更改了绑定:

<bindings>
    <binding protocol="http" bindingInformation="*:25436:localhost" />
    <binding protocol="https" bindingInformation="*:44300:localhost" />
</bindings>

对此:

<bindings>
    <binding protocol="http" bindingInformation="*:25436:127.0.0.1" />
    <binding protocol="https" bindingInformation="*:44300:127.0.0.1" />
</bindings>

我什至尝试将IP放在像127.0.0.1:25436:这样的端口之前,这是我阅读的另一篇文章所建议的解决该问题的方法.

启动项目时出现此问题:

我不知道该如何解决.请帮忙!

解决方案

为了子孙后代-

本地PC上的HTTPS需要证书. 通常,称为自签名证书"的东西就足够了. IIS Express通常在首次安装时为您创建一个.

Windows开始>键入"mmc". 文件>添加管理单元>证书>添加>计算机帐户>下一步/完成/确定,输入证书"部分>个人>证书 您应该会看到IIS Express证书.

如果没有,则需要重新安装IIS Express,它将为您添加新的证书.

双击IIS Express证书,然后向下滚动到缩略图字段. 将整个指纹复制到编辑器中,然后删除所有空格. (您可以简单地进行搜索和替换"并替换为")(请参见附件) 现在,以具有管理员权限的CMD打开,运行此命令:

netsh http add sslcert ipport=0.0.0.0:44300 certhash=0000000000003ed9cd0c315bbb6dc1c08da5e6 appid={00112233-4455-6677-8899-AABBCCDDEEFF} 

  • 据我所知,appid并不重要.
  • 确保您添加了正确的https端口号.
  • 确保您没有添加隐藏字符,否则将失败.

现在,作为最后一步,您需要将此证书拖到受信任的根证书..."部分.

完成.

I am creating an ASP.NET web application and currently running it with Visual Studio's built in IIS Express. It normally starts up on localhost and runs just fine. However, one of the external API's I'm calling requires the callback of my application redirect to 127.0.0.1 instead of localhost (it uses the OAuth2 flow for authentication). I realize localhost is just an alias for 127.0.0.1 but for some reason I cannot get my application to run on 127.0.0.1.

I have gone into the project settings under the "Web" tab and changed Start Action > Start URL and Servers > Project URL both to http://127.0.0.1:25436 and even went into IIS Express's applicationhost.config and changed the bindings from this:

<bindings>
    <binding protocol="http" bindingInformation="*:25436:localhost" />
    <binding protocol="https" bindingInformation="*:44300:localhost" />
</bindings>

to this:

<bindings>
    <binding protocol="http" bindingInformation="*:25436:127.0.0.1" />
    <binding protocol="https" bindingInformation="*:44300:127.0.0.1" />
</bindings>

I even tried putting the IP before the port like 127.0.0.1:25436: as suggested by another article I read to solve this problem.

When I start the project I get this problem:

I can't figure out how to get around this. Please help!

解决方案

For the sake of future generations -

HTTPS on your local pc requires a certificate. Usually something called a "Self signed certificate" is enough. IIS Express usually creates one for you the first time it's installed.

Windows Start > type "mmc". File > Add snap-in > Certificates > Add > Computer account > Next/Finish/OK Enter the "Certificates" section > Personal > Certificates You should see an IIS Express Certificate.

If not, you need to re-install IIS Express and it will add a new certificate for you.

Double-click the IIS Express certificate and scroll down to the Thumbprint Field. Copy the entire thumbprint into an editor and remove all spaces. (you can simply do a search&replace " " and replace by "") (see attached image) Now, with the CMD open with Admin rights, run this:

netsh http add sslcert ipport=0.0.0.0:44300 certhash=0000000000003ed9cd0c315bbb6dc1c08da5e6 appid={00112233-4455-6677-8899-AABBCCDDEEFF} 

  • As far as I know, the appid isn't critical.
  • Make sure you add the correct https port number.
  • Make sure you didn't add hidden characters or else this will fail.

Now, as a last step, you need to drag this certificate to the "Trusted Root Certification..." section.

Done.

这篇关于127.0.0.1该网站无法提供安全的连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆