1

I have visited to this link and got to know about the differences between localhost and localIP address.

I have got problem saying Access is denied while accessing my own asp.net api hosted in my local IIS server with the following url

http://172.18.12.166/FinalApi/api/movie.

It works finely if I use following url to access the api

http://localhost/FinalApi/api/movie

In the console of browser the request can be visualized as

enter image description here

This means the request is completed with no error. But this returns no data if I use localIP address in case of localhost.

But this works finely while requesting from other computers on the same network.

Community
  • 1
  • 1
Jeetendra
  • 205
  • 3
  • 18
  • Most probably you are running into cross domain request as `localhost` is considered different domain than `local IP`. You need to either create URL properly (to always work in the same domain) or enable CORS in your Web API. – tpeczek Sep 10 '13 at 11:18

1 Answers1

0

Look for host file at the following location on your system:

C:\WINDOWS\system32\drivers\etc

in that change the mapping of localhost (by default it would be 127.0.0.1). Change it to map to your IP. Then set up the you website in IIS server as per IP address.

Hope this helps.

Shashank Chaturvedi
  • 2,756
  • 19
  • 29
  • I have gone through this but every time the saving process fails informing 'Please check if this file is opened in another program'. I have restarted my PC and again tried but saving continues to fail. – Jeetendra Sep 11 '13 at 04:57
  • I can not think of a reason for this to happen. Probably you could try changing the host file from an administrators account. – Shashank Chaturvedi Sep 11 '13 at 05:08