HTTP Error 503. The service is unavailable.

Issue:

I’m getting an error 503 when visited a newly created site in IIS with AppPool account. Is it error in my code?

Service Unavailable
HTTP Error 503. The service is unavailable.

Environment:

Windows 2012 R2, IIS 8.5, ASP.Net

Resolution:

This error happened usually is because app pool is down. To start an app pool service, please follow following steps.

Step-by-step instructions:-

  1. Open IIS Manager on your web server
  2. Browse to “Application Pools”
  3. Verify app pool status by checking status column next to app pool name that is being used by the app
  4. Right click on app pool name and select “Start” to start app pool service
  5. Go to web browser and check if the application is up and running

Troubleshoot:

For ASP.Net project, is always good idea to turn off custom error on development server. Do not  turn off custom error on production server to avoid security risk. To turn custom error off, change mode to “Off” on web.config:

<customErrors mode="Off" />

 

TFS Build Error on NuGet Restore Task ECONNREFUSED

Issue:

I’m trying to add third new agent to default pool and get an error message on NuGet restore task during testing. The error is “##[error]connect ECONNREFUSED 152.199.4.184:443”. What did I do wrong?

2019-06-23T16:12:22.1309391Z ##[section]Starting: NuGet restore
2019-06-23T16:12:22.1465660Z ==============================================================================
2019-06-23T16:12:22.1465660Z Task         : NuGet Restore
2019-06-23T16:12:22.1465660Z Description  : Restores NuGet packages in preparation for a Visual Studio Build step.
2019-06-23T16:12:22.1465660Z Version      : 1.0.1
2019-06-23T16:12:22.1465660Z Author       : Microsoft Corporation
2019-06-23T16:12:22.1465660Z Help         : [More Information](https://go.microsoft.com/fwlink/?LinkID=613747)
2019-06-23T16:12:22.1465660Z ==============================================================================
2019-06-23T16:12:23.1623101Z [command]C:\Windows\system32\chcp.com 65001
2019-06-23T16:12:23.1623101Z Active code page: 65001
2019-06-23T16:12:24.2466118Z ##[error]connect ECONNREFUSED 152.199.4.184:443
2019-06-23T16:12:24.2466118Z ##[section]Finishing: NuGet restore

Environment:

TFS 2019, Visual Studio 2019, Build Server Agents Version 2.122.1 with Proxy, Build Definition with NuGet Restore Version 1.0.1

Resolution:

Most likely the problem is with connection to outside world. But in this case, it was because it’s missing NuGet.exe file under agent folder \_work\_tool\NuGet\4.0.0\x64\nuget.exe. To make sure you have this file, please check under your TFS Agent folder under _work\_tool\NuGet\4.0.0\x64. Please follow below instructions to check if web proxy setup correctly.

Step-by-step instructions:-

  1. Open File Explorer and browse to where you install TFS Agent
  2. First locate a proxy file named: .proxy (you may need to show hidden file to see it)
  3. Open .proxy file with Notepad and make sure the web proxy gateway name is correct with http/https prefix and port number
  4. Second, check \externals\vstshost\LegacyVSTSPowerShellHost.exe.config file for web proxy settings
  5. Open LegacyVSTSPowerShellHost.exe.config and check if you have defaultProxy attribute under system.net section
      <system.net>
        <defaultProxy useDefaultCredentials="true">
          <proxy proxyaddress="http://your.proxy.com:8080" bypassonlocal="true" />
        </defaultProxy>
      </system.net>
  6. Third, check if you have nuget.exe install under agent folder \_work\_tool\NuGet\4.0.0\x64\
  7. Four (optional), sync \_work\_tasks folder with other agent build server so all build servers have same packages installed
  8. Restart the VSTS Agent service and try to build again

Troubleshoot:

To make sure build server is using proxy to connect to external source, check with firewall log.

Reference:

Create Build Definition