简体   繁体   中英

503 service unavailable IIS + localhost + WebAPI + VS Android Emulator .Net Core 2

I don't have any other idea.

I have WebAPI (.NetCore 2) running on my localhost on IIS. When I connect to it using Postman, everything works fine. But when I try to connect from VS Android Emulator I am getting only 503 errors. I think I tried everything.

My settings are: - WebApi is running on port 8080

应用程序设置

My VS Emulator networks settings are: 模拟器网络设置

I am connecting to WebApi using: http://169.254.80.80:8080/api/

On localhost (for example from Postman) is: http://localhost:8080/api/

I have added Incoming Rule to my windows defender allowing connections for TCP port 8080.

This is my SITES section from applicationhost.

<sites>
  <site name="WebSite1" id="1" serverAutoStart="true">
    <application path="/">
      <virtualDirectory path="/" physicalPath="%IIS_SITES_HOME%\WebSite1" />
    </application>
    <bindings>
      <binding protocol="http" bindingInformation=":8080:localhost" />
    </bindings>
  </site>
  <site name="Nerdolando.Boomerang.WebAPI" id="2">
    <application path="/" applicationPool="Clr4IntegratedAppPool">
      <virtualDirectory path="/" physicalPath="D:\projekty\cs\Boomerang\source\webapi\Nerdolando.Boomerang.WebAPI" />
    </application>
    <bindings>
      <binding protocol="http" bindingInformation="*:50628:localhost" />
      <binding protocol="http" bindingInformation="*:50628:169.254.80.80" />
      <binding protocol="http" bindingInformation="169.254.80.80:8080" />
      <binding protocol="http" bindingInformation="*:8080:169.254.80.80" />
    </bindings>
  </site>
  <siteDefaults>
    <logFile logFormat="W3C" directory="%IIS_USER_HOME%\Logs" />
    <traceFailedRequestsLogging directory="%IIS_USER_HOME%\TraceLogFiles" enabled="true" maxLogFileSizeKB="1024" />
  </siteDefaults>
  <applicationDefaults applicationPool="Clr4IntegratedAppPool" />
  <virtualDirectoryDefaults allowSubDirConfig="true" />
</sites>

As you can see, I tried different bindings. And still getting 503 error. What can I do more?

Your IIS binding is wrong: http:*:8080:localhost

You have "localhost" in the 'Host name' field. That means that IIS will only send traffic to that site if "localhost" is used as the domain name. Since you are trying to access by IP, IIS doesn't know which site to send it to and gives you a 503.

Your binding should look like this (leave the 'Host name' blank):

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM