'Refused to connect' error when trying to add app in SharePoint 2019

shashank 131 Reputation points
2022-08-03T08:26:04.857+00:00

Question:
When I am trying to add an app in SharePoint 2019, it says 'refused to connect'

Steps to reproduce error:

Open the app (K2 in my case) from site contents

227641-image.png

Click on Add It button

227568-image.png

Error shows up as "Refused to Connect"

227632-image.png

SharePoint Server
SharePoint Server
A family of Microsoft on-premises document management and storage systems.
2,350 questions
SharePoint Server Development
SharePoint Server Development
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Development: The process of researching, productizing, and refining new or existing technologies.
1,615 questions
SharePoint Server Management
SharePoint Server Management
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Management: The act or process of organizing, handling, directing or controlling something.
2,951 questions
0 comments No comments
{count} votes

4 answers

Sort by: Most helpful
  1. RaytheonXie_MSFT 35,711 Reputation points Microsoft Vendor
    2022-08-10T06:40:34.303+00:00

    Hi @shashank ,
    I'm glad to hear you solve the problem ,if you have any issue about SharePoint, you are welcome to raise a ticket in this forum.

    By the way, since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others." and according to the scenario introduced here: Answering your own questions on Microsoft Q&A, I would make a brief summary of this thread:

    ['Refused to connect' error when trying to add app in SharePoint 2019]

    Issue Symptom:
    User is unable to add app in SharePoint 2019

    Current status:
    It's resolved by following Steps
    First of all we need to install URL Rewrite IIS extension if it is not done yet. After that go to IIS Manager, select appropriate Sharepoint site and click URL Rewrite on the right side. Create new empty outbound rule like it is shown on the following picture:
    229836-image.png

    You could click the "Accept Answer" button for this summary to close this thread, and this can make it easier for other community member's to see the useful information when reading this thread. Thanks for your understanding!

    1 person found this answer helpful.

  2. Peter Groft 106 Reputation points
    2022-08-03T08:29:39.113+00:00

    Enable Apps in Your SharePoint 2019 On-premise Farm
    Step 1: Go to Central Administration. Open SharePoint 2019 Central Administration. From your SharePoint Server 2019 farm, open SharePoint 2019 Central Administration.
    Step 2: Go to Store Settings. Navigate to Apps and Configure Store Settings. Start a trial.

    Regards,
    Peter


  3. RaytheonXie_MSFT 35,711 Reputation points Microsoft Vendor
    2022-08-04T03:11:40.327+00:00

    Hi @shashank ,

    1. First, Please verify that the user account that is performing this procedure is a member of the site Owners group.
    2. Disable and then re-enable the App Installation Service via Central Administration > Monitoring > Review job definitions > App Installation Service.
    3. If you are still unable to add app, please try following powershell to install it param
      (
      [string]$Web = $(throw '- Need a SharePoint web site URL (e.g. "http://mysp15site/")'),
      [string]$Source = "ObjectModel"
      ) Write-Host -ForegroundColor White "----------------------------------"
      Write-Host -ForegroundColor White "| Corporate News App Installer |"
      Write-Host -ForegroundColor White "----------------------------------"
      Write-Host -ForegroundColor White "- " #Global vars
      $AppPackageName = "CorporateNewsApp.app"; #Loads powershell settings
      Write-Host -ForegroundColor White "- Load Powershell context.."
      $0 = $myInvocation.MyCommand.Definition
      $dp0 = [System.IO.Path]::GetDirectoryName($0) #Loads the SharePoint snapin
      Write-Host -ForegroundColor White "- Load SharePoint context.."
      $ver = $host | select version
      if ($ver.Version.Major -gt 1) {$host.Runspace.ThreadOptions = "ReuseThread"}
      if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null) {
      Add-PSSnapin "Microsoft.SharePoint.PowerShell";
      }
      [void][System.Reflection.Assembly]::Load("Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c") #Imports the App package
      Write-Host -ForegroundColor White "- Import app package '$AppPackageName'..."
      $appPath = $dp0 + "" + $AppPackageName;
      if ($Source.Equals("ObjectModel", [System.StringComparison]::InvariantCultureIgnoreCase)) {
      $sourceApp = ([microsoft.sharepoint.administration.spappsource]::ObjectModel);
      }
      elseif ($Source.Equals("Marketplace", [System.StringComparison]::InvariantCultureIgnoreCase)) {
      $sourceApp = ([microsoft.sharepoint.administration.spappsource]::Marketplace);
      }
      elseif ($Source.Equals("CorporateCatalog", [System.StringComparison]::InvariantCultureIgnoreCase)) {
      $sourceApp = ([microsoft.sharepoint.administration.spappsource]::CorporateCatalog);
      }
      elseif ($Source.Equals("DeveloperSite", [System.StringComparison]::InvariantCultureIgnoreCase)) {
      $sourceApp = ([microsoft.sharepoint.administration.spappsource]::DeveloperSite);
      }
      elseif ($Source.Equals("RemoteObjectModel", [System.StringComparison]::InvariantCultureIgnoreCase)) {
      $sourceApp = ([microsoft.sharepoint.administration.spappsource]::RemoteObjectModel);
      } $spapp = Import-SPAppPackage -Path "$appPath" -Site $Web -Source $sourceApp -Confirm:$false -ErrorAction SilentlyContinue -ErrorVariable err;
      if ($err -or ($spapp -eq $null))
      {
      Write-Host -ForegroundColor Yellow "- An error occured during app import !"
      throw $err;
      }
      Write-Host -ForegroundColor White "- Package imported with success." #Installs the App
      Write-Host -ForegroundColor White "- Install the APP in web site..."
      $app = Install-SPApp -Web $Web -Identity $spapp -Confirm:$false -ErrorAction SilentlyContinue -ErrorVariable err;
      if ($err -or ($app -eq $null)) {
      Write-Host -ForegroundColor Yellow "- An error occured during app installation !"
      throw $err;
      }
      $AppName = $app.Title;
      Write-Host -ForegroundColor White "- App '$AppName' registered, please wait during installation..."
      $appInstance = Get-SPAppInstance -Web $Web | where-object {$.Title -eq $AppName};
      $counter = 1;
      $maximum = 150;
      $sleeptime = 2;
      Write-Host -ForegroundColor White "- Please wait..." -NoNewline;
      while (($appInstance.Status -eq ([Microsoft.SharePoint.Administration.SPAppInstanceStatus]::Installing)) -and ($counter -lt $maximum))
      {
      Write-Host -ForegroundColor White "." -NoNewline;
      sleep $sleeptime;
      $counter++;
      $appInstance = Get-SPAppInstance -Web $Web | where-object {$
      .Title -eq $AppName}
      }
      Write-Host -ForegroundColor White "."; if ($appInstance.Status -eq [Microsoft.SharePoint.Administration.SPAppInstanceStatus]::Installed) {
      Write-Host -ForegroundColor White "- The App was successfully installed.";
      $appUrl = $appInstance.AppWebFullUrl;
      Write-Host -ForegroundColor White "- The App is now available at '$appUrl'.";
      Write-Host -ForegroundColor White "- (Don't forget to add app host name in your host file if necessary...).";
      Write-Host -ForegroundColor White "- "
      }
      else {
      Write-Host -ForegroundColor Yellow "- An unknown error has occured during app installation. Read SharePoint log for more information.";
      }

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.



  4. Marcos Nunes 0 Reputation points
    2023-11-09T11:59:11.4+00:00

    You can use this PS script to solve it:

    add-pssnapin *

    $f=get-spfarm

    $f.AddGenericAllowedListValue("AllowIframeAppAuthorizePageDomains","yourdomain")

    $f.update()

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.