Lar*_*tel 3 networking python ip
我正在 Windows 8 上编写 Python (Flask)。为了向外部公开网络应用程序,我过去设置了 host=0.0.0.0
由于我升级和/或安装了具有 Internet 访问权限的 Hyper-V,因此我无法使用以下方法连接到 Flask Web 应用程序
http://0.0.0.0:5000.
Run Code Online (Sandbox Code Playgroud)
我尝试关闭 Windows 防火墙无济于事。
这是错误:
This webpage is not available
The webpage at http://0.0.0.0:5000/ might be temporarily down or it may have moved permanently to a new web address.
Error 108 (net::ERR_ADDRESS_INVALID): Unknown error.
Run Code Online (Sandbox Code Playgroud)
我也觉得很奇怪,虽然应用程序在 0.0.0.0 上运行,但我可以通过 localhost/127.0.0.1 访问它。
如何打开/启用对 0.0.0.0 的访问?
>route print
===========================================================================
Interface List
40...c8 60 00 cb fc 55 ......Hyper-V Virtual Ethernet Adapter #2
18...94 db c9 8a c1 c5 ......Bluetooth Device (Personal Area Network)
15...96 db c9 ac 27 c1 ......Microsoft Wi-Fi Direct Virtual Adapter
14...94 db c9 ac 27 c1 ......Broadcom 802.11n Network Adapter
12...c8 60 00 cc 03 5e ......Intel(R) 82579V Gigabit Network Connection
1...........................Software Loopback Interface 1
===========================================================================
IPv4 Route Table
===========================================================================
Active Routes:
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 192.168.1.1 192.168.1.143 20
127.0.0.0 255.0.0.0 On-link 127.0.0.1 306
127.0.0.1 255.255.255.255 On-link 127.0.0.1 306
127.255.255.255 255.255.255.255 On-link 127.0.0.1 306
192.168.1.0 255.255.255.0 On-link 192.168.1.143 276
192.168.1.143 255.255.255.255 On-link 192.168.1.143 276
192.168.1.255 255.255.255.255 On-link 192.168.1.143 276
224.0.0.0 240.0.0.0 On-link 127.0.0.1 306
224.0.0.0 240.0.0.0 On-link 192.168.1.143 276
255.255.255.255 255.255.255.255 On-link 127.0.0.1 306
255.255.255.255 255.255.255.255 On-link 192.168.1.143 276
===========================================================================
Persistent Routes:
None
IPv6 Route Table
===========================================================================
Active Routes:
If Metric Network Destination Gateway
1 306 ::1/128 On-link
1 306 ff00::/8 On-link
===========================================================================
Persistent Routes:
None
Run Code Online (Sandbox Code Playgroud)
我也觉得很奇怪,虽然应用程序在 0.0.0.0 上运行,但
我可以通过 localhost/127.0.0.1 访问它。
那是因为应用程序没有在 0.0.0.0 运行 0.0.0.0
只是用于“所有 IP,来自任何地方”的符号。
如果该应用程序在您自己的桌面上运行,那么您可以通过以下方式访问它:
归档时间: |
|
查看次数: |
13058 次 |
最近记录: |