Check out example codes for "If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address.". It will help you in understanding the concepts better.

Code Example 1

Then I went to Visual Studio and changed the server setting (Right mouse on the project, properties, tab Web, click Use local IIS Web Server and click Create Virtual Directory. When I did this, it worked under IIS with the code above.

Learn ReactJs, React Native from akashmittal.com