SharePoint Pals
 | Sign In
Step by Step Procedure to Create a Low Trust Provider Hosted App for Office 365 and Host the AppWeb in Local IIS
by Sathish Nadarajan 15 Aug 2016
SharePoint MVP
Today  :   20     Total  :    1848

In the earlier article, we saw how to create a Low trust Provider Hosted App and host it in Azure Web Site. Now, let us see how to create a Low trust Provider Hosted App for Office 365, in fact Office 365 accepts only Low Trust Apps alone and Host the App web in Local IIS Server.

Almost all the steps are same except few. As far as considering the Visual Studio, all the steps are same. Only one big difference is, the APPWeb will be hosted in Local IIS Server. That will help a lot to debug. Anyhow, we are able to debug the Azure App Web also. But always, it is easy to keep the AppWeb on the Local IIS Server. Even, if required, we can move the APP Web from Local to Azure for the Customer’s environment.

The Pre-requires are as follows.

1. Office 365 Subscription

2. Visual Studio 2015 (Professional/Community/Enterprise Edition)

With the pre-requisites ready, let us start with step by step

1. Login to the Office 365 and Create a Developer Site.


2. Login to the INETMGR and Create the Local IIS Sites.


3. Click on “Add WebSite”


4. Add an Entry on the Hosts File. The Host File can be found in the path “c:\Windows\System32\Drivers\etc\”

5. The entry is as follows.

a. Office365PHA

6. We need to Create a Self-Signed Certificate and Bind the Certificate to the newly created Web Site.

7. To Create a self-signed certificate, this time, we are going to use PowerShell Script with the –DNSName.

The Script is as

New-SelfSignedCertificate -DnsName Office365PHA -CertStoreLocation cert:\LocalMachine\My

8. Let us open the PowerShell window as Administrator.

9. Enter the above mentioned Script.


10. Once, the certificate got created, go to IIS and Server Certificates. We should be able to see the newly created certificate.


11. Double Click and Copy to File.


12. Copy the CER file to any location.







13. With this, let us open the Visual Studio to Create the APP Project.


14. Select the App Type and enter the O365 URL.


15. Enter the Credential.


16. Select the Target Version of SharePoint.


17. Select the Project Type.


18. Select the Authentication Settings for the Low Trust.


19. On Click of Finish, the Solution will get created. The Solution will looks like below.


20. Now, Go to the APPREGNEW.aspx and register the Client ID and Client Secret ID.


21. Once, got created, copy the clientid and client Secret ID to a notepad.


22. Now, let us go back to the IIS and the Certificates. Go to the location where we stored the Certificate exported.


23. Right Click the Cer file. Click on Install Certificate.


24. Follow the below Wizards.






25. Now, Open the IIS and Select the WebSite which we created on the Earlier Steps.

26. Enable the Directory Browsing.


27. Right Click and Select Edit Bindings.


28. Add a Binding.



29. Now, launch the URLs, http://Office365PHA and https://Office365PHA and make sure that there is no exception. Though we have not provisioned the APP, but still we are making sure that the IIS does not have any issues.

30. Let us go back to the Visual Studio and update the AppManifest.xml.

31. The Updated XML will look like below.

 <?xml version="1.0" encoding="utf-8" ?>
 <App xmlns=""
     <RemoteWebApplication ClientId="21bd3e55-507c-4f1a-bf63-d17022a74e8a" />
   <AppPermissionRequests AllowAppOnlyPolicy="false">
     <AppPermissionRequest Scope="http://sharepoint/content/sitecollection/web" Right="FullControl" />

32. Update the Web.Config of the APP Web Project with the new ClientID and Client secret


33. Now, we are done. We need to publish the APP Web into the Local IIS. For that, follow the below steps.

34. Select the APPWeb and Click on Properties.


35. On the Web Tab, select the Local IIS and give the Redirect URI.


36. Click on “Create Virtual Directory”

37. Virtual Directory Got Created.


38. To Confirm, go to IIS and verify the Folder Structure.

39. In our case, it got created properly.


40. Now, we need to Publish the APP Project. For that, right click on the APPWeb and Click Publish. Note: Purposely, we are selecting the APPWeb, instead of the APP. Let me tell you in the below section, why we are doing this.


41. Click on Custom

42. Give the Profile Name and Click OK.


43. On the Below Screen, don’t give anything. Simply Close.


44. Save the Changes.


45. Now, Come back to the APP Project and Click Publish.


46. We will see the Profile which we created in the earlier step. Otherwise, the profile will not get created here. That’s why, I asked you to create the profile using the APPWeb Project and use the Profile in APP Project.

47. Click on Edit Profile and Enter the Client ID and the Client Secret properly.



48. Now, the Warning near to Edit will be gone.


49. Click on “Package the APP” Button and Enter the URL


50. We will get the Publish Success message.


51. Go to App Catalog Site. Refer HERE for further information regarding App Catalog

52. Upload the APP file into the App Catalog “Apps for SharePoint” List.



53. Now, come back to our Developer Site and go to Site Contents.

54. Click on “ADD an APP”


55. Select the APP


56. Trust the APP


57. This will take few minutes to Add the app.

58. Launch the APP


59. We will be seeing the Title of the SP Site.


60. Now, let us put a break point on your Source Code and attach the process with W3WP Process.


61. We can see the Debugger stops as shown below.


With this, the Office 365 Provider Hosted App, Hosted on Local IIS is covered. Let us see some more interesting topics in the upcoming articles.

Happy Coding,

Sathish Nadarajan.

blog comments powered by Disqus

SharePoint Pals

SharePoint Pals, a community portal for SharePoint developers, Administrators and End Users. Let's join hands and share the point together.
Read this on mobile


Angular Js Training In Chennai
Advanced Angular Js training with real world developer scenarios
Angular Js, Web Api and Ionic for .Net Developers
All in one client side application development for .Net developers
Angular Js For SharePoint Developers
Get ready for the future. Its no more just C#

Get Connected

SharePoint Resources

SharePoint 2013 and 2010 Web Parts
Free Web Parts with Source Code for SharePoint Community

SharePoint 2013 Books and Tutorials
Collection of free SharePoint 2013 books and tutorials (eBooks, pdfs)

Supported By

Contribute your article and be eligible for a one month Free Subscription for Plural Sight. The Author of the most popular New Article (published in the previous month) will be awarded with a Free One month Plural Sight Subscription. Article can be sent to in a word document.

Related Resources

Recent Tweets

Twitter October 23, 22:21
How to Add/Remove User Custom Actions (in Site Actions Menu) Programmatically using CSOM PNP in SharePoint -

Twitter October 21, 21:34
How to Add a JS Link Reference to the Display Form or Any other ASPX Programmatically using CSOM PNP in SharePoint -

Twitter October 20, 13:01
How to Add a JS Link Reference to the NewForm and EditForm Programmatically using CSOM PNP in SharePoint Office 365-

Twitter October 12, 12:15
How to Deploy Provider Hosted Apps (Add-Ins) by App Stapling in SharePoint Office 365 -

Twitter October 11, 13:39
How to Deploy Provider HostedApp programmatically using CSOM in SharePoint Office 365 Activating Developer Feature -

Follow us @SharePointPals
Note: For Customization and Configuration, CheckOutRecent Tweets Documentation