I have created an Function App using Visual Studio 2017 and I created some APIs. That API was worked on my system very fine. But from another system its gets the "bad request / site can't be reached".

enter image description here

My question is, how can I call my API from the another system? Anyone please give me solution.

5

2 Answers

If you created a v2 function, please check your function CLI output when debugging locally. At the third line, there should be Now listening on:

If you see Now listening on: , it means your function CLI is old so that it still binds to localhost, which stop you accessing function with your local IP.

Apparently solution is to use the latest CLI. On VS menus, Tools->Extensions and Updates, find Azure Functions and Web Jobs Tools, update it to latest version(15.0.40617.0). Then things should work with new CLI.

Note that local functions can only be visited by systems in the same LAN, otherwise you should make the function available in public, have a look at ngrok. And if you use v1 function, its latest CLI still binds to localhost, have to resort to tools like ngrok if needed.

At VS debugging site, IIS Express and localhost + port are used by default.

In order to use IP address and multi domain debugging, we can find applicationhost.config under C:\Users\...\Documents\IISExpress\config\applicationhost.config and find the following code:

enter image description here

Add a similar line in the <bindings> tag:

 <binding protocol="http" bindingInformation="*:7071:192.168.1.17" /> 

Then open the CMD command window as an administrator:

netsh http add urlacl url= user=everyone 

Finally, you can access this site with IP address

More information for your reference: IIS Express enable external request

2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy