在调试状态下使用本机ip访问webapi
1、在调试模式下无法通过ip访问webapi ,但是可以使用localhost或者127.0.0.1加端口访问


2、因为在调试模式下运行它,Vs2022默认正在使用IIS-Express。默认情况下,IIS-Express仅绑定到localhost.

 3、为了调试状态可以通过ip访问,需要打开位于以下位置的IIS-Express应用程序配置文件:C:\Users\<username>\My Documents\IISExpress\config\applicationhost.config并修改站点的绑定信息.
更改
  <binding protocol="http" bindingInformation=":8080:localhost" />
至
  <binding protocol="http" bindingInformation=":8080:*" />
必须在更改后重新启动IIS-Express.
 
                    
                     
                    
                 
                    
                
 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号