I want to create a web application using powershell. Below is a list of commands I execute to achieve this and all works fine. Web application exists everywhere. But I cannot access it by it's url. I think I don't have a good underestanding of "HostHeader" thing.

When I type web application url in my browser I get an error indicating that the broswer cannot find this web site.

And I Insist to use powershell not central administration.

$user = Get-SPManagedAccount "Pouyanserver\Administrator"

$auth = New-SPAuthenticationProvider

New-SPWebApplication -Name "Mahan Air" -port 8080 -HostHeader "MahanAir" -url             "MahanAir:8080" -ApplicationPool "Mahan Air" -ApplicationPoolAccount $user -AuthenticationProvider $auth

what is the problem ? and what is the host header anyway ? when it just does not work?

  • you have a web application, but did you create a site collection at its root? Sep 21, 2013 at 11:51

1 Answer 1


Host header is the part of the URL, e.g. it is the "mysite" in http://mysite.example.com. You need to make sure you configure DNS to have an A record of "mysite" that points to the IP address assigned to the IIS site in the IIS Manager.

  • How can I configure my dns ? for example if I say that my host header is "MySite". Then how should I tell the system that "Mysite" actually refers to localhost with a different port ?
    – Pouyan
    Sep 20, 2013 at 17:31
  • You would make sure that IIS responds to "mysite" (check the IIS Site Bindings in the IIS Manager) on the appropriate port (you can use 80, or another port if desired). In DNS, you would create an A record of "mysite" that points to the IP address of the IIS site binding. How you set up the record in the DNS server depends on the DNS server software (e.g. it is Microsoft DNS, or BIND, etc).
    – user6024
    Sep 20, 2013 at 17:35
  • IIS Binding is ok ... it says that you can access this web application by "mysite" on Port 8080. But I don't know about DNS ? I think I don't have DNS server role installed on my server ... how can I add a dns record ?
    – Pouyan
    Sep 20, 2013 at 17:47
  • You should have DNS installed elsewhere. If you have Active Directory (which you should), then it would likely be on the Domain Controller(s).
    – user6024
    Sep 20, 2013 at 18:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.