0

I am developing SharePoint Hosted App and followed steps mentioned in below Microsoft link to create app domain.

https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/set-up-an-on-premises-development-environment-for-sharepoint-add-ins

Here is how my addin url look like on my dev box after installation of addin

http://add-in-4566480226b84e.MachineName:1300/AddInName

Add-in_Prefix: add-in

Add-in_ID: 4566480226b84e

Add-in_Base_Domain: MachineName:1300

Add-in_Name: AddInName

When I deploy the addin from Visual Studio 2017 it adds below entry in host file and I understand why this entry is required.

127.0.0.1 add-in-4566480226b84e.MachineName # 65ea9305-f44a-4aab-8fb3-b97f7f273177;http://MachineName:1300/

::1 add-in-4566480226b84e.MachineName # 65ea9305-f44a-4aab-8fb3-b97f7f273177;http://MachineName:1300/

When I install addin with below command it does not add host file entries and have to add the host entry manually.

$MyApp = Import-SPAppPackage `
    -Path "C:\Ravi\AddIn.app" `
    -Site "http://MachineName:1300/" `
    -Source DeveloperSite `
    -Confirm:$false
Install-SPApp -Web "http://MachineName:1300/" -Identity $MyApp 

Now I have to move this addin to the production environment and I am guessing below is how url will be formed.

SharePoint URL

http://product.companyname.com

Addin Url

http://add-in-4566480226b84e.product.companyname.com/AddInName

My question is

  1. Am I correct on my understanding of production addin url?

  2. how url will be resolved? When I was in my dev environment I host file was updated by VS2017/manually and url was resolved. Now I am in production, will the url be resolved automatically or I have to do some special additional configuration.

Ravi Khambhati
  • 637
  • 1
  • 12
  • 35

1 Answers1

0

You need to configure your farm to host applications/add-ins. Three parts are required:

  • the subscription service application

  • the application registration service application

  • the DNS configuration

The last one is documented here on what's required and how to configure that one Windows. However it might defer depending on your DNS infrastructure. Microsoft documentation

baywet
  • 4,377
  • 4
  • 20
  • 49
  • Thanks a lot for your answer. I will take a look at it and will respond. – Ravi Khambhati Oct 26 '17 at 21:30
  • I looked at the links and it's not what I am looking for. My question is around understanding for url in production. If I move my addin to production will the url be like http://add-in-4566480226b84e.product.companyname.com/AddInName. If yes then when I redeploy the same addin second time the addin id will change so the whole url will be changed. So after second deployment, user will have to browse new url. If this is not how url will be formed then I would like to understand the same. – Ravi Khambhati Oct 27 '17 at 18:01
  • It's not exactly like that and the url depends on the configuration. But the general idea it correct. Two deployments will give you different urls for the app web – baywet Oct 27 '17 at 18:06
  • Is there a way I can keep the URL constant so that if a user has saved the URL in favorites then they do not have to change it. – Ravi Khambhati Oct 27 '17 at 18:11
  • In case of an upgrade it should stay the same for a single deployment of you bump the version. Otherwise not that I know of – baywet Oct 27 '17 at 18:12
  • So what I understand is if we upgrade the AddIn then it will not change the AppId? Did I follow you correctly? – Ravi Khambhati Oct 27 '17 at 18:15
  • yes, if done properly, add-ins upgrade don't change the app web url. That's because being the scenes, a dedicated SPWeb is used for each instance/deployment. – baywet Oct 27 '17 at 19:14
  • Thanks @baywet. Is there a way where I can configure app url from http://add-in-4566480226b84e.product.companyname.com/AddInName to http://AddInName.companyname-addin.com/. – Ravi Khambhati Oct 27 '17 at 20:59
  • It depends on you're infrastructure and it's configuration. A cname in the DNS might do the trick but it might cause issues for authentication as well. I'd say you should try and see if it works in your case – baywet Oct 27 '17 at 21:57
  • Thanks for help @baywet. Will give it a try and respond. – Ravi Khambhati Oct 30 '17 at 13:38