Search code examples
c#hostingasp.net-coreasp.net-core-mvcport80

ASP.NET5 | MVC6 project hosting using 80 port


There is a MVC 6 (beta 7) project. I published it by the VisualStudio 2015 publish wizard to a local folder (on Windows Server 2012). Here is the hosting.ini file:

server=Microsoft.AspNet.Server.WebListener
server.urls=http://localhost:80

Here is a command for starting the server in the project.json:

"web": "Microsoft.AspNet.Hosting --config hosting.ini",

I started the server by executing the web.cmd generated by a publish wizard from the local folder.

Site is working fine from a local machine (http://localhost).

Ok, now is the most interesting. I try to open it from an external computer and see

HTTP Error 404. The requested resource is not found.

Response headers are:

Connection:close

Content-Length:315

Content-Type:text/html;

charset=us-ascii Server:Microsoft-HTTPAPI/2.0

Ok, I found a similar problem with the WAMP/Apache hosting, for example this and this.

I tried to do the following:

  1. Disabling the World Wide Web Publishing Service
  2. Disabling the Web Deployment Agent Service
  3. Making sure that there are not SQL Server Reporting Services and Branch Cache Service
  4. Disabling IIS
  5. Adding a rule for port 80 in a firewall
  6. Killing all process from the tasklist /M httpapi.dll command by its PID (after that there is no listening of 80 port from the netstat -ano command) and then start application.

But it did not help.

For note: Here is a result of the tasklist /M httpapi.dll command after start the application after clause 6:

enter image description here

Here is a process with PID 1800:

enter image description here

What and why blocks 80-port?

How can I get around this?

Thank you!


Solution

  • I assume that the issue is the bindings you have for the site. In your config you say:

    server.urls=http://localhost:80
    

    This means the site will only respond to you if you have the URL http://localhost in your browser window, however from an external URL you would use http://192.168.100.100 for example. Try changing the URL to match that (obviously use your own IP address or machine name):

    server.urls=http://192.168.100.100:80
    

    I think you can also specify multiple URLs by separating them with either a semi colon or a comma:

    server.urls=http://localhost:80;http://server:80;http://192.168.100.100:80