This project has moved and is read-only. For the latest updates, please go here.

Cannot find an SPWebApplication object that contains the following Name...

Oct 24, 2013 at 9:28 AM
Edited Oct 24, 2013 at 9:31 AM
Getting this error when script tries to create site collection.

Installing SharePoint 2013 on single server development environment.

Here is my AutoSPInstallerInput file...

Any ideas??

Thanks in advance!!!
 - Creating web applications...
 - Web app "Portal" already provisioned.
 - Setting up managed paths for "http://htvsp13dev1:80"
 - Setting up explicit managed path "help" at "http://htvsp13dev1:80"
 - Done setting up managed paths at "http://htvsp13dev1:80"
 - Granting i:0#.w|DEV\ Full Control to http://htvsp13dev1/...
 - Applying object cache accounts to "http://htvsp13dev1:80"...
 - Granting i:0#.w|DEV\SP13.DEV.Farm Full Control to http://htvsp13dev1/...
 - Granting i:0#.w|DEV\SP13.DEV.Farm Full Read to http://htvsp13dev1/...
 - Done applying object cache accounts to "http://htvsp13dev1:80"
 - Creating Site Collection "http://htvspt13dev1"...
 - Script halted!

Exception             : Microsoft.SharePoint.PowerShell.SPCmdletPipeBindException: Cannot find an SPWebApplication
                        object that contains the following Name, Id, or Url: http://htvspt13dev1.
                           at Microsoft.SharePoint.PowerShell.SPWebApplicationPipeBind.Read(Boolean exactUrl)
                           at Microsoft.SharePoint.PowerShell.SPCmdletNewSite.InternalValidate()
                           at Microsoft.SharePoint.PowerShell.SPCmdlet.ProcessRecord()
TargetObject          : Microsoft.SharePoint.PowerShell.SPCmdletNewSite
CategoryInfo          : InvalidData: (Microsoft.Share...SPCmdletNewSite:SPCmdletNewSite) [New-SPSite],
FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletNewSite
ErrorDetails          :
InvocationInfo        : System.Management.Automation.InvocationInfo
ScriptStackTrace      : at CreateWebApp, \\htvspt13dev1\c$\SP13_DEV_Setup\Scripts\SharePoint2013\AutoSPInstaller\AutoSP
                        InstallerFunctions.ps1: line 2372
                        at CreateWebApplications, \\htvspt13dev1\c$\SP13_DEV_Setup\Scripts\SharePoint2013\AutoSPInstall
                        er\AutoSPInstallerFunctions.ps1: line 2217
                        at Setup-Farm, \\htvspt13dev1\c$\SP13_DEV_Setup\Scripts\SharePoint2013\AutoSPInstaller\AutoSPIn
                        stallerMain.ps1: line 190
                        at <ScriptBlock>, \\htvspt13dev1\c$\SP13_DEV_Setup\Scripts\SharePoint2013\AutoSPInstaller\AutoS
                        PInstallerMain.ps1: line 361
                        at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo : {}
PSMessageDetails      :
Oct 24, 2013 at 10:35 AM

I did not manage to check your AutoSPInstallerInput file but the web application is created successfully and its failing to create site collection. If you change this line from <ManagedPath relativeUrl="help" explicit="true" /> to <ManagedPath relativeUrl="help" explicit="false" />, with false that should be able to create the site collection.

Hope this helps.
Oct 24, 2013 at 12:05 PM
Edited Oct 24, 2013 at 12:29 PM
If you try to create the web application using Central Administration using the same parameters, do you get an error? if so, what is it?

Also site owner account should not be really the app pool account. This is not the reason for the error, but just a thought on your XML.
Oct 24, 2013 at 3:14 PM
Thanks @macdee21 changed to false but did not work, still got same error
Oct 24, 2013 at 3:18 PM
Edited Oct 24, 2013 at 3:19 PM
Thanks @josephsaad Its the site collection that errors, the web application get created fine. I tried creating site collection through central admin and works fine with no error but when I try to navigate to url the browser says that the page cannot be displayed??

thanks for the pointer about the owner account :)
Oct 25, 2013 at 12:46 AM
Found the issue! In my AutoSPInstallerInput file for the site collection I had
<SiteCollection siteUrl="http://htvspt13dev1"
                                Name="Portal Home"
                                Description="Portal Home Site"
Changed HostNamedSiteCollection to true and created site collection fine
<SiteCollection siteUrl="http://htvspt13dev1"
I assume that this setting is referring to if you are creating a 'root' site collection for the web app (like in my case, what I wanted to do)
Marked as answer by pagemedias on 10/24/2013 at 4:56 PM