Script Halted - No endpoint listening

Topics: Support
Sep 7 at 6:12 PM
Receiving the below error:
  • Script halted!
Exception : System.ServiceModel.EndpointNotFoundException: There
                    was no endpoint listening at http://localhost:32843/Sec
                    urityTokenServiceApplication/securitytoken.svc that 
                    could accept the message. This is often caused by an 
                    incorrect address or SOAP action. See InnerException, 
                    if present, for more details. ---> 
                    System.Net.WebException: Unable to connect to the 
                    remote server ---> System.Net.Sockets.SocketException: 
                    No connection could be made because the target machine 
                    actively refused it 127.0.0.1:32843
                       at System.Net.Sockets.Socket.DoConnect(EndPoint 
                    endPointSnapshot, SocketAddress socketAddress)
                       at 
                    System.Net.ServicePoint.ConnectSocketInternal(Boolean 
                    connectFailure, Socket s4, Socket s6, Socket& socket, 
                    IPAddress& address, ConnectSocketState state, 
                    IAsyncResult asyncResult, Exception& exception)
                       --- End of inner exception stack trace ---
                       at System.Net.HttpWebRequest.GetRequestStream(Transp
                    ortContext& context)
                       at System.Net.HttpWebRequest.GetRequestStream()
                       at System.ServiceModel.Channels.HttpOutput.WebReques
                    tHttpOutput.GetOutputStream()
                       --- End of inner exception stack trace ---

                    Server stack trace: 
                       at System.ServiceModel.Channels.HttpOutput.WebReques
                    tHttpOutput.GetOutputStream()
                       at 
                    System.ServiceModel.Channels.HttpOutput.Send(TimeSpan 
                    timeout)
                       at System.ServiceModel.Channels.HttpChannelFactory`1
                    .HttpRequestChannel.HttpChannelRequest.SendRequest(Mess
                    age message, TimeSpan timeout)
                       at System.ServiceModel.Channels.RequestChannel.Reque
                    st(Message message, TimeSpan timeout)
                       at System.ServiceModel.Channels.ServiceChannel.Call(
                    String action, Boolean oneway, ProxyOperationRuntime 
                    operation, Object[] ins, Object[] outs, TimeSpan 
                    timeout)
                       at System.ServiceModel.Channels.ServiceChannelProxy.
                    InvokeService(IMethodCallMessage methodCall, 
                    ProxyOperationRuntime operation)
                       at System.ServiceModel.Channels.ServiceChannelProxy.
                    Invoke(IMessage message)

                    Exception rethrown at [0]: 
                       at System.Runtime.Remoting.Proxies.RealProxy.HandleR
                    eturnMessage(IMessage reqMsg, IMessage retMsg)
                       at System.Runtime.Remoting.Proxies.RealProxy.Private
                    Invoke(MessageData& msgData, Int32 type)
                       at Microsoft.IdentityModel.Protocols.WSTrust.IWSTrus
                    tContract.Issue(Message message)
                       at Microsoft.IdentityModel.Protocols.WSTrust.WSTrust
                    Channel.Issue(RequestSecurityToken rst, 
                    RequestSecurityTokenResponse& rstr)
                       at Microsoft.IdentityModel.Protocols.WSTrust.WSTrust
                    Channel.Issue(RequestSecurityToken rst)
                       at Microsoft.SharePoint.SPSecurityContext.SecurityTo
                    kenForContext(Uri context, Boolean bearerToken, 
                    SecurityToken onBehalfOf, SecurityToken actAs, 
                    SecurityToken delegateTo, 
                    SPRequestSecurityTokenProperties properties)
                       at Microsoft.SharePoint.SPSecurityContext.SecurityTo
                    kenForLegacyLoginContext(Uri context)
                       at 
                    Microsoft.SharePoint.SPSite.InitUserToken(SPRequest 
                    request)
                       at 
                    Microsoft.SharePoint.SPSite.SPSiteConstructor(SPFarm 
                    farm, Guid applicationId, Guid contentDatabaseId, Guid 
                    siteId, Guid siteSubscriptionId, SPUrlZone zone, Uri 
                    requestUri, String serverRelativeUrl, Boolean 
                    hostHeaderIsSiteName, SPUserToken userToken, Boolean 
                    appWebRequest, String appHostHeaderRedirectDomain, 
                    String appSiteDomainPrefix, String subscriptionName, 
                    String appSiteDomainId, Uri primaryUri)
                       at Microsoft.SharePoint.SPSite..ctor(SPFarm farm, 
                    Uri requestUri, Boolean contextSite, Boolean 
                    swapSchemeForPathBasedSites, SPUserToken userToken)
                       at Microsoft.SharePoint.SPSite..ctor(SPFarm farm, 
                    Uri requestUri, Boolean contextSite)
                       at Microsoft.SharePoint.Administration.SPSiteCollect
                    ion.get_Item(String strSiteName)
                       at Microsoft.SharePoint.Administration.SPConfigurati
                    onDatabase.CreateSite(SPWebApplication application, 
                    SPContentDatabase database, String originalPath, Guid 
                    id, Guid siteSubscriptionId, Boolean 
                    useHostHeaderAsSiteName, Boolean bDeleted, DateTime 
                    deletionTime, String subscriptionName, String 
                    appSiteDomainId, List`1 siteUrls, Boolean bResyncMode)
                       at Microsoft.SharePoint.Administration.SPConfigurati
                    onDatabase.CreateSite(SPWebApplication application, 
                    SPContentDatabase database, String path, Boolean 
                    useHostHeaderAsSiteName)
                       at Microsoft.SharePoint.Administration.SPSiteCollect
                    ion.Add(SPContentDatabase database, SPSiteSubscription 
                    siteSubscription, String siteUrl, String title, String 
                    description, UInt32 nLCID, Int32 compatibilityLevel, 
                    String webTemplate, String ownerLogin, String 
                    ownerName, String ownerEmail, String 
                    secondaryContactLogin, String secondaryContactName, 
                    String secondaryContactEmail, String quotaTemplate, 
                    String sscRootWebUrl, Boolean useHostHeaderAsSiteName, 
                    Boolean overrideCompatibilityRestriction)
                       at Microsoft.SharePoint.PowerShell.SPCmdletNewSite.C
                    reateDataObject()
                       at Microsoft.SharePoint.PowerShell.SPNewCmdletBase`1
                    .InternalProcessRecord()
                       at Microsoft.SharePoint.PowerShell.SPCmdlet.ProcessR
                    ecord()
TargetObject : Microsoft.SharePoint.PowerShell.SPCmdletNewSite
CategoryInfo : InvalidData:
                    (Microsoft.Share...SPCmdletNewSite:SPCmdletNewSite) 
                    [New-SPSite], EndpointNotFoundException
FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletNewSite
ErrorDetails :
InvocationInfo : System.Management.Automation.InvocationInfo
ScriptStackTrace : at CreateWebApp, C:\Temp\SP\AutoSPInstaller\AutoSPInsta
                    llerFunctions.ps1: line 2889
                    at CreateWebApplications, C:\Temp\SP\AutoSPInstaller\Au
                    toSPInstallerFunctions.ps1: line 2670
                    at Setup-Farm, 
                    C:\Temp\SP\AutoSPInstaller\AutoSPInstallerMain.ps1: 
                    line 211
                    at <ScriptBlock>, 
                    C:\Temp\SP\AutoSPInstaller\AutoSPInstallerMain.ps1: 
                    line 410
                    at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo : {}
PSMessageDetails :


All app pools are running and I can browse to the link:
http://localhost:32843/SecurityTokenServiceApplication/securitytoken.svc

As soon as script tries to run above link becomes unavailable