This article is a mirror article of machine translation, please click here to jump to the original article.

View: 16517|Reply: 0

[Solved] Writing a web service with C# HttpListener gives a 503 error

[Copy link]
Posted on 11/23/2016 2:39:07 PM | | | |
Some time ago, when I wrote a web service using HttpListener in C#, it started running fine.
After a while, the server restarted, and although the service started normally, it could no longer be accessed, and a 503 error appeared directly when browsing the web. But after changing the port number, the service is normal again, and after a while, a 503 error appears.
After troubleshooting, use the netstat command in cmd to check whether the port number is occupied, and it seems that the port number is not occupied by any program. Then the problem was located in the error when accessing the URL, and after consulting some information, it was found that it was a problem with the URL cache.

Clean the URL cache
The specific operation is as follows:
  • Start running "cmd"
  • Type "netsh" enter
  • Enter "http" enter
  • Enter "show urlacl" enter(At this time, you can already see some URL addresses of the port number you set, for example: http://+:9997/)
  • Enter "delete urlacl http://+:9997/" (delete URL address cache)
Then restart my Http service and it will be back to normal immediately.

The interface is as follows






Previous:c# Use OCR to recognize Chinese images
Next:EasyUI verification confirms that the password and the new password are consistent
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com