且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

无法通过从浏览器中键入URL来直接访问我的Web api数据

更新时间:2023-12-03 08:05:46

假设您在两台计算机之间没有防火墙,只需将localhost替换为您计算机的名称或IP地址。



因此,而不是: http:// localhost:port / api / employees

使用: http:// your-pc-name:port / api / employees



如果计算机之间有防火墙,则需要打开端口或托管API在端口80上的IIS中,而不是使用Visual Studio的内置Web服务器。
Assuming you don't have a firewall between the two computers, just replace "localhost" with the name or IP address of your computer.

So instead of: http://localhost:port/api/employees
Use: http://your-pc-name:port/api/employees

If you have a firewall between the computers, you'll either need to open the port, or host your API in IIS on port 80 instead of using Visual Studio's built-in web server.