10

What are the differences between these two prefixes in terms of HttpListener or any other?

http://+:8080/

http://*:8080/
CodeFox
  • 3,321
  • 1
  • 29
  • 41
Pankaj
  • 9,749
  • 32
  • 139
  • 283
  • How is this related to ASp.NET in any way given that this is http.sys in the kernel that takes and handles those? – TomTom Feb 27 '12 at 03:33
  • 1
    Some people from Microsoft misunderstood that it is under ASP.NET and they by mistake mentioned it in this link http://msdn.microsoft.com/en-us/library/system.net.httplistener.aspx – Pankaj Feb 27 '12 at 03:39
  • Still not Asp.net, you know. System.Net is the network part (not asp.net specific) and they clearly state this goes to http.sys. Try reading more than one line and understanding it, please. – TomTom Feb 27 '12 at 06:27
  • Possible duplicate of [What's the difference between http://\*:80 and http://+:80](https://stackoverflow.com/questions/4598164/whats-the-difference-between-http-80-and-http-80) – default May 15 '19 at 14:08

2 Answers2

17

http://*:8080/: Receive all HTTP requests on port 8080 that are not already being handled by some other HttpListener.

http://+:8080/: Receive all HTTP requests on port 8080 even if they're already handled by another HttpListener.

CodeFox
  • 3,321
  • 1
  • 29
  • 41
Paul
  • 139,544
  • 27
  • 275
  • 264
  • will like you explain it with an example or with link ? whatever you like – Pankaj Feb 27 '12 at 09:05
  • Thank you for the explanation! The [official documentation](https://msdn.microsoft.com/en-us/library/system.net.httplistener(v=vs.110).aspx) is not very clear in this detail. – CodeFox Jan 22 '15 at 06:40
1

In addition to @Paulpro's great answer, the link posted by @rownage (see this answer) provides some more information about the difference:

Strong wildcard (Plus Sign +)

When the host element of a UrlPrefix consists of a single plus sign (+), the UrlPrefix matches all possible host names in the context of its scheme, port and relativeURI elements, and falls into the strong wildcard category.

A strong wildcard is useful when an application needs to serve requests addressed to one or more relativeURIs, regardless of how those requests arrive on the machine or what site they specify in their Host headers. Use of a strong wildcard in this situation avoids the need to specify an exhaustive list of host and/or IP-addresses.

Weak wildcard (Asterisk *)

When an asterisk (*) appears as the host element, then the UrlPrefix falls into the weak wildcard category. This kind of UrlPrefix matches any host name associated with the specified scheme, port and relativeURI that has not already been matched by a strong-wildcard, explicit, or IP-bound weak-wildcard UrlPrefix.

This host specification can be used as a default catch-all in some circumstances, or can be used to specify a large section of URL namespace without having to use many UrlPrefixes.

Community
  • 1
  • 1
CodeFox
  • 3,321
  • 1
  • 29
  • 41